Sha256: 7dbdad443332e59d5a7629f290d869e9f7e9f1cb12ecab5eb973c295625527bc
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
require 'test_helper' module Workarea class SwappableListTest < TestCase setup :set_list def set_list @list = SwappableList.new([:one, :two, :three]) end def test_inserts_at_the_index @list.insert(1, :one_and_a_half) assert_equal(:one_and_a_half, @list[1]) end def test_inserts_the_value_after_the_index @list.insert_after(1, :two_and_a_half) assert_equal(:two_and_a_half, @list[2]) end def test_swap_changes_the_value_at_the_index @list.swap(:two, :TWO) assert_equal(:TWO, @list[1]) end def test_delete_changes_the_value_at_the_index @list.delete(:three) assert_equal(2, @list.size) end def test_returns_a_new_swappable_list_with_element_added @list = SwappableList.new([:one, :two, :three]) @list += :four assert_instance_of(SwappableList, @list) assert_includes(@list, :four) end def test_returns_a_new_swappable_list_with_element_removed @list = SwappableList.new([:one, :two, :three]) @list -= :three assert_instance_of(SwappableList, @list) refute_includes(@list, :three) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
workarea-core-3.4.14 | test/lib/workarea/swappable_list_test.rb |
workarea-core-3.4.13 | test/lib/workarea/swappable_list_test.rb |
workarea-core-3.4.12 | test/lib/workarea/swappable_list_test.rb |