Class: SetTest
- Defined in:
- lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/set_test.rb
Overview
require ‘test/model_stub’
Instance Method Summary collapse
- #setup ⇒ Object
- #test_add ⇒ Object
- #test_block_config ⇒ Object
- #test_exclude ⇒ Object
- #test_exclude_array ⇒ Object
- #test_include ⇒ Object
- #test_initialization ⇒ Object
- #test_length ⇒ Object
- #test_remove ⇒ Object
Instance Method Details
#setup ⇒ Object
5 6 7 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/set_test.rb', line 5 def setup @items = ActiveScaffold::DataStructures::Set.new(:a, :b) end |
#test_add ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/set_test.rb', line 41 def test_add # try adding a simple column using a string assert !@items.include?(:c) @items.add 'c' assert @items.include?(:c) # try adding a simple column using a symbol assert !@items.include?(:d) @items.add :d assert @items.include?(:d) # test that << also adds assert !@items.include?(:e) @items << "e" assert @items.include?(:e) # try adding an array of columns assert !@items.include?(:f) @items.add [:f, :g] assert @items.include?(:f) assert @items.include?(:g) end |
#test_block_config ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/set_test.rb', line 69 def test_block_config @items.configure do |config| # we may use the config argument config.add :c # or we may not exclude :b end assert @items.include?(:c) assert !@items.include?(:b) end |
#test_exclude ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/set_test.rb', line 15 def test_exclude # exclude with a symbol assert @items.include?(:b) @items.exclude :b assert !@items.include?(:b) # exclude with a string assert @items.include?(:a) @items.exclude 'a' assert !@items.include?(:a) end |
#test_exclude_array ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/set_test.rb', line 27 def test_exclude_array # exclude with a symbol assert @items.include?(:b) @items.exclude [:a, :b] assert !@items.include?(:b) assert !@items.include?(:a) end |
#test_include ⇒ Object
81 82 83 84 85 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/set_test.rb', line 81 def test_include assert @items.include?(:a) assert @items.include?(:b) assert !@items.include?(:d) end |
#test_initialization ⇒ Object
9 10 11 12 13 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/set_test.rb', line 9 def test_initialization assert @items.include?(:a) assert @items.include?(:b) assert !@items.include?(:c) end |
#test_length ⇒ Object
65 66 67 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/set_test.rb', line 65 def test_length assert_equal 2, @items.length end |
#test_remove ⇒ Object
35 36 37 38 39 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/set_test.rb', line 35 def test_remove assert @items.include?(:a) @items.remove 'a' assert !@items.include?(:a) end |