diff options
Diffstat (limited to 'spec/ruby/library/set')
23 files changed, 59 insertions, 59 deletions
diff --git a/spec/ruby/library/set/compare_by_identity_spec.rb b/spec/ruby/library/set/compare_by_identity_spec.rb index 01b66ec92b..a6ad794ad3 100644 --- a/spec/ruby/library/set/compare_by_identity_spec.rb +++ b/spec/ruby/library/set/compare_by_identity_spec.rb @@ -93,7 +93,7 @@ describe "Set#compare_by_identity" do it "raises a #{frozen_error_class} on frozen sets" do set = Set.new.freeze - lambda { + -> { set.compare_by_identity }.should raise_error(frozen_error_class, /frozen Hash/) end diff --git a/spec/ruby/library/set/exclusion_spec.rb b/spec/ruby/library/set/exclusion_spec.rb index c9fa0e287e..5bc4b5a2bf 100644 --- a/spec/ruby/library/set/exclusion_spec.rb +++ b/spec/ruby/library/set/exclusion_spec.rb @@ -12,7 +12,7 @@ describe "Set#^" do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set ^ 3 }.should raise_error(ArgumentError) - lambda { @set ^ Object.new }.should raise_error(ArgumentError) + -> { @set ^ 3 }.should raise_error(ArgumentError) + -> { @set ^ Object.new }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/flatten_merge_spec.rb b/spec/ruby/library/set/flatten_merge_spec.rb index b4494b13a7..f2c99a9481 100644 --- a/spec/ruby/library/set/flatten_merge_spec.rb +++ b/spec/ruby/library/set/flatten_merge_spec.rb @@ -18,6 +18,6 @@ describe "Set#flatten_merge" do set2 = Set[5, 6, 7] set2 << set2 - lambda { set1.send(:flatten_merge, set2) }.should raise_error(ArgumentError) + -> { set1.send(:flatten_merge, set2) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/flatten_spec.rb b/spec/ruby/library/set/flatten_spec.rb index be94630f48..4ac83ea825 100644 --- a/spec/ruby/library/set/flatten_spec.rb +++ b/spec/ruby/library/set/flatten_spec.rb @@ -13,7 +13,7 @@ describe "Set#flatten" do it "raises an ArgumentError when self is recursive" do (set = Set[]) << set - lambda { set.flatten }.should raise_error(ArgumentError) + -> { set.flatten }.should raise_error(ArgumentError) end context "when Set contains a Set-like object" do @@ -42,7 +42,7 @@ describe "Set#flatten!" do it "raises an ArgumentError when self is recursive" do (set = Set[]) << set - lambda { set.flatten! }.should raise_error(ArgumentError) + -> { set.flatten! }.should raise_error(ArgumentError) end context "when Set contains a Set-like object" do diff --git a/spec/ruby/library/set/merge_spec.rb b/spec/ruby/library/set/merge_spec.rb index 5c65af0a9b..a8e3ffc870 100644 --- a/spec/ruby/library/set/merge_spec.rb +++ b/spec/ruby/library/set/merge_spec.rb @@ -13,7 +13,7 @@ describe "Set#merge" do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { Set[1, 2].merge(1) }.should raise_error(ArgumentError) - lambda { Set[1, 2].merge(Object.new) }.should raise_error(ArgumentError) + -> { Set[1, 2].merge(1) }.should raise_error(ArgumentError) + -> { Set[1, 2].merge(Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/proper_subset_spec.rb b/spec/ruby/library/set/proper_subset_spec.rb index 20c354b655..1f496a6199 100644 --- a/spec/ruby/library/set/proper_subset_spec.rb +++ b/spec/ruby/library/set/proper_subset_spec.rb @@ -27,10 +27,10 @@ describe "Set#proper_subset?" do end it "raises an ArgumentError when passed a non-Set" do - lambda { Set[].proper_subset?([]) }.should raise_error(ArgumentError) - lambda { Set[].proper_subset?(1) }.should raise_error(ArgumentError) - lambda { Set[].proper_subset?("test") }.should raise_error(ArgumentError) - lambda { Set[].proper_subset?(Object.new) }.should raise_error(ArgumentError) + -> { Set[].proper_subset?([]) }.should raise_error(ArgumentError) + -> { Set[].proper_subset?(1) }.should raise_error(ArgumentError) + -> { Set[].proper_subset?("test") }.should raise_error(ArgumentError) + -> { Set[].proper_subset?(Object.new) }.should raise_error(ArgumentError) end context "when comparing to a Set-like object" do diff --git a/spec/ruby/library/set/proper_superset_spec.rb b/spec/ruby/library/set/proper_superset_spec.rb index abc0e44f96..a386c8c097 100644 --- a/spec/ruby/library/set/proper_superset_spec.rb +++ b/spec/ruby/library/set/proper_superset_spec.rb @@ -27,10 +27,10 @@ describe "Set#proper_superset?" do end it "raises an ArgumentError when passed a non-Set" do - lambda { Set[].proper_superset?([]) }.should raise_error(ArgumentError) - lambda { Set[].proper_superset?(1) }.should raise_error(ArgumentError) - lambda { Set[].proper_superset?("test") }.should raise_error(ArgumentError) - lambda { Set[].proper_superset?(Object.new) }.should raise_error(ArgumentError) + -> { Set[].proper_superset?([]) }.should raise_error(ArgumentError) + -> { Set[].proper_superset?(1) }.should raise_error(ArgumentError) + -> { Set[].proper_superset?("test") }.should raise_error(ArgumentError) + -> { Set[].proper_superset?(Object.new) }.should raise_error(ArgumentError) end context "when comparing to a Set-like object" do diff --git a/spec/ruby/library/set/shared/difference.rb b/spec/ruby/library/set/shared/difference.rb index 52807709c3..f88987ed2a 100644 --- a/spec/ruby/library/set/shared/difference.rb +++ b/spec/ruby/library/set/shared/difference.rb @@ -9,7 +9,7 @@ describe :set_difference, shared: true do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set.send(@method, 1) }.should raise_error(ArgumentError) - lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError) + -> { @set.send(@method, 1) }.should raise_error(ArgumentError) + -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/shared/intersection.rb b/spec/ruby/library/set/shared/intersection.rb index ed0db7457d..5ae4199c94 100644 --- a/spec/ruby/library/set/shared/intersection.rb +++ b/spec/ruby/library/set/shared/intersection.rb @@ -9,7 +9,7 @@ describe :set_intersection, shared: true do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set.send(@method, 1) }.should raise_error(ArgumentError) - lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError) + -> { @set.send(@method, 1) }.should raise_error(ArgumentError) + -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/shared/union.rb b/spec/ruby/library/set/shared/union.rb index 81920f5687..314f0e852d 100644 --- a/spec/ruby/library/set/shared/union.rb +++ b/spec/ruby/library/set/shared/union.rb @@ -9,7 +9,7 @@ describe :set_union, shared: true do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set.send(@method, 1) }.should raise_error(ArgumentError) - lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError) + -> { @set.send(@method, 1) }.should raise_error(ArgumentError) + -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/add_spec.rb b/spec/ruby/library/set/sortedset/add_spec.rb index 721ac7fac0..5f8bde02f5 100644 --- a/spec/ruby/library/set/sortedset/add_spec.rb +++ b/spec/ruby/library/set/sortedset/add_spec.rb @@ -8,13 +8,13 @@ describe "SortedSet#add" do it "takes only values which responds <=>" do obj = mock('no_comparison_operator') obj.stub!(:respond_to?).with(:<=>).and_return(false) - lambda { SortedSet["hello"].add(obj) }.should raise_error(ArgumentError) + -> { SortedSet["hello"].add(obj) }.should raise_error(ArgumentError) end it "raises on incompatible <=> comparison" do # Use #to_a here as elements are sorted only when needed. # Therefore the <=> incompatibility is only noticed on sorting. - lambda { SortedSet['1', '2'].add(3).to_a }.should raise_error(ArgumentError) + -> { SortedSet['1', '2'].add(3).to_a }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/exclusion_spec.rb b/spec/ruby/library/set/sortedset/exclusion_spec.rb index 59f9f1dfd8..d0f1ab95cb 100644 --- a/spec/ruby/library/set/sortedset/exclusion_spec.rb +++ b/spec/ruby/library/set/sortedset/exclusion_spec.rb @@ -12,7 +12,7 @@ describe "SortedSet#^" do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set ^ 3 }.should raise_error(ArgumentError) - lambda { @set ^ Object.new }.should raise_error(ArgumentError) + -> { @set ^ 3 }.should raise_error(ArgumentError) + -> { @set ^ Object.new }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/initialize_spec.rb b/spec/ruby/library/set/sortedset/initialize_spec.rb index cdf756f6b8..1238f4efc4 100644 --- a/spec/ruby/library/set/sortedset/initialize_spec.rb +++ b/spec/ruby/library/set/sortedset/initialize_spec.rb @@ -25,6 +25,6 @@ describe "SortedSet#initialize" do it "raises on incompatible <=> comparison" do # Use #to_a here as elements are sorted only when needed. # Therefore the <=> incompatibility is only noticed on sorting. - lambda { SortedSet.new(['00', nil]).to_a }.should raise_error(ArgumentError) + -> { SortedSet.new(['00', nil]).to_a }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/merge_spec.rb b/spec/ruby/library/set/sortedset/merge_spec.rb index f98f2c83ce..31570ad4db 100644 --- a/spec/ruby/library/set/sortedset/merge_spec.rb +++ b/spec/ruby/library/set/sortedset/merge_spec.rb @@ -13,7 +13,7 @@ describe "SortedSet#merge" do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { SortedSet[1, 2].merge(1) }.should raise_error(ArgumentError) - lambda { SortedSet[1, 2].merge(Object.new) }.should raise_error(ArgumentError) + -> { SortedSet[1, 2].merge(1) }.should raise_error(ArgumentError) + -> { SortedSet[1, 2].merge(Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/proper_subset_spec.rb b/spec/ruby/library/set/sortedset/proper_subset_spec.rb index 3b3c2e5c4c..818173a7f9 100644 --- a/spec/ruby/library/set/sortedset/proper_subset_spec.rb +++ b/spec/ruby/library/set/sortedset/proper_subset_spec.rb @@ -25,9 +25,9 @@ describe "SortedSet#proper_subset?" do end it "raises an ArgumentError when passed a non-SortedSet" do - lambda { SortedSet[].proper_subset?([]) }.should raise_error(ArgumentError) - lambda { SortedSet[].proper_subset?(1) }.should raise_error(ArgumentError) - lambda { SortedSet[].proper_subset?("test") }.should raise_error(ArgumentError) - lambda { SortedSet[].proper_subset?(Object.new) }.should raise_error(ArgumentError) + -> { SortedSet[].proper_subset?([]) }.should raise_error(ArgumentError) + -> { SortedSet[].proper_subset?(1) }.should raise_error(ArgumentError) + -> { SortedSet[].proper_subset?("test") }.should raise_error(ArgumentError) + -> { SortedSet[].proper_subset?(Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/proper_superset_spec.rb b/spec/ruby/library/set/sortedset/proper_superset_spec.rb index 72ae71e2f1..2699290f0e 100644 --- a/spec/ruby/library/set/sortedset/proper_superset_spec.rb +++ b/spec/ruby/library/set/sortedset/proper_superset_spec.rb @@ -25,9 +25,9 @@ describe "SortedSet#proper_superset?" do end it "raises an ArgumentError when passed a non-SortedSet" do - lambda { SortedSet[].proper_superset?([]) }.should raise_error(ArgumentError) - lambda { SortedSet[].proper_superset?(1) }.should raise_error(ArgumentError) - lambda { SortedSet[].proper_superset?("test") }.should raise_error(ArgumentError) - lambda { SortedSet[].proper_superset?(Object.new) }.should raise_error(ArgumentError) + -> { SortedSet[].proper_superset?([]) }.should raise_error(ArgumentError) + -> { SortedSet[].proper_superset?(1) }.should raise_error(ArgumentError) + -> { SortedSet[].proper_superset?("test") }.should raise_error(ArgumentError) + -> { SortedSet[].proper_superset?(Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/shared/difference.rb b/spec/ruby/library/set/sortedset/shared/difference.rb index cf50ff0eb2..688e23a7a7 100644 --- a/spec/ruby/library/set/sortedset/shared/difference.rb +++ b/spec/ruby/library/set/sortedset/shared/difference.rb @@ -9,7 +9,7 @@ describe :sorted_set_difference, shared: true do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set.send(@method, 1) }.should raise_error(ArgumentError) - lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError) + -> { @set.send(@method, 1) }.should raise_error(ArgumentError) + -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/shared/intersection.rb b/spec/ruby/library/set/sortedset/shared/intersection.rb index d3cfa96656..045716ad05 100644 --- a/spec/ruby/library/set/sortedset/shared/intersection.rb +++ b/spec/ruby/library/set/sortedset/shared/intersection.rb @@ -9,7 +9,7 @@ describe :sorted_set_intersection, shared: true do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set.send(@method, 1) }.should raise_error(ArgumentError) - lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError) + -> { @set.send(@method, 1) }.should raise_error(ArgumentError) + -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/shared/union.rb b/spec/ruby/library/set/sortedset/shared/union.rb index 4ff07ef5cc..9015bdc8e3 100644 --- a/spec/ruby/library/set/sortedset/shared/union.rb +++ b/spec/ruby/library/set/sortedset/shared/union.rb @@ -9,7 +9,7 @@ describe :sorted_set_union, shared: true do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set.send(@method, 1) }.should raise_error(ArgumentError) - lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError) + -> { @set.send(@method, 1) }.should raise_error(ArgumentError) + -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/subset_spec.rb b/spec/ruby/library/set/sortedset/subset_spec.rb index cdada2cdfb..7768692df6 100644 --- a/spec/ruby/library/set/sortedset/subset_spec.rb +++ b/spec/ruby/library/set/sortedset/subset_spec.rb @@ -25,9 +25,9 @@ describe "SortedSet#subset?" do end it "raises an ArgumentError when passed a non-SortedSet" do - lambda { SortedSet[].subset?([]) }.should raise_error(ArgumentError) - lambda { SortedSet[].subset?(1) }.should raise_error(ArgumentError) - lambda { SortedSet[].subset?("test") }.should raise_error(ArgumentError) - lambda { SortedSet[].subset?(Object.new) }.should raise_error(ArgumentError) + -> { SortedSet[].subset?([]) }.should raise_error(ArgumentError) + -> { SortedSet[].subset?(1) }.should raise_error(ArgumentError) + -> { SortedSet[].subset?("test") }.should raise_error(ArgumentError) + -> { SortedSet[].subset?(Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/superset_spec.rb b/spec/ruby/library/set/sortedset/superset_spec.rb index 663b179a0c..823781b860 100644 --- a/spec/ruby/library/set/sortedset/superset_spec.rb +++ b/spec/ruby/library/set/sortedset/superset_spec.rb @@ -25,9 +25,9 @@ describe "SortedSet#superset?" do end it "raises an ArgumentError when passed a non-SortedSet" do - lambda { SortedSet[].superset?([]) }.should raise_error(ArgumentError) - lambda { SortedSet[].superset?(1) }.should raise_error(ArgumentError) - lambda { SortedSet[].superset?("test") }.should raise_error(ArgumentError) - lambda { SortedSet[].superset?(Object.new) }.should raise_error(ArgumentError) + -> { SortedSet[].superset?([]) }.should raise_error(ArgumentError) + -> { SortedSet[].superset?(1) }.should raise_error(ArgumentError) + -> { SortedSet[].superset?("test") }.should raise_error(ArgumentError) + -> { SortedSet[].superset?(Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/subset_spec.rb b/spec/ruby/library/set/subset_spec.rb index a1aed45ad0..f375efa6df 100644 --- a/spec/ruby/library/set/subset_spec.rb +++ b/spec/ruby/library/set/subset_spec.rb @@ -27,10 +27,10 @@ describe "Set#subset?" do end it "raises an ArgumentError when passed a non-Set" do - lambda { Set[].subset?([]) }.should raise_error(ArgumentError) - lambda { Set[].subset?(1) }.should raise_error(ArgumentError) - lambda { Set[].subset?("test") }.should raise_error(ArgumentError) - lambda { Set[].subset?(Object.new) }.should raise_error(ArgumentError) + -> { Set[].subset?([]) }.should raise_error(ArgumentError) + -> { Set[].subset?(1) }.should raise_error(ArgumentError) + -> { Set[].subset?("test") }.should raise_error(ArgumentError) + -> { Set[].subset?(Object.new) }.should raise_error(ArgumentError) end context "when comparing to a Set-like object" do diff --git a/spec/ruby/library/set/superset_spec.rb b/spec/ruby/library/set/superset_spec.rb index 1336975a9b..bd9d2f3eee 100644 --- a/spec/ruby/library/set/superset_spec.rb +++ b/spec/ruby/library/set/superset_spec.rb @@ -27,10 +27,10 @@ describe "Set#superset?" do end it "raises an ArgumentError when passed a non-Set" do - lambda { Set[].superset?([]) }.should raise_error(ArgumentError) - lambda { Set[].superset?(1) }.should raise_error(ArgumentError) - lambda { Set[].superset?("test") }.should raise_error(ArgumentError) - lambda { Set[].superset?(Object.new) }.should raise_error(ArgumentError) + -> { Set[].superset?([]) }.should raise_error(ArgumentError) + -> { Set[].superset?(1) }.should raise_error(ArgumentError) + -> { Set[].superset?("test") }.should raise_error(ArgumentError) + -> { Set[].superset?(Object.new) }.should raise_error(ArgumentError) end context "when comparing to a Set-like object" do |