Sha256: 5013280681ea04fd5ddc94456d6b755eb3a8f04f3b16b013b8b1a2c5bf5d1866
Contents?: true
Size: 1.09 KB
Versions: 6
Compression:
Stored size: 1.09 KB
Contents
require 'test_helper' class DatabaseRewinder::CleanerTest < ActiveSupport::TestCase sub_test_case '#strategy=' do setup { @cleaner = DatabaseRewinder::Cleaner.new(only: ['foos'], except: 'bars') } test 'without options' do @cleaner.strategy = :truncation # it should keep instance variables assert_equal ['foos'], @cleaner.instance_variable_get(:@only) assert_equal ['bars'], @cleaner.instance_variable_get(:@except) end test 'with options (an array or a string)' do @cleaner.strategy = :truncation, { only: ['bars'], except: 'bazs' } # it should overwrite instance variables assert_equal ['bars'], @cleaner.instance_variable_get(:@only) assert_equal ['bazs'], @cleaner.instance_variable_get(:@except) end test 'with options (an empty array or nil)' do @cleaner.strategy = :truncation, { only: [], except: nil } # it should overwrite instance variables even if they are empty/nil assert_equal [], @cleaner.instance_variable_get(:@only) assert_equal [], @cleaner.instance_variable_get(:@except) end end end
Version data entries
6 entries across 6 versions & 1 rubygems