1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Move spec/rubyspec to spec/ruby for consistency

* Other ruby implementations use the spec/ruby directory.
  [Misc #13792] [ruby-core:82287]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2017-09-20 20:18:52 +00:00
parent 75bfc6440d
commit 1d15d5f080
4370 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,14 @@
describe :set_add, shared: true do
before :each do
@set = Set.new
end
it "adds the passed Object to self" do
@set.send(@method, "dog")
@set.should include("dog")
end
it "returns self" do
@set.send(@method, "dog").should equal(@set)
end
end

View file

@ -0,0 +1,20 @@
describe :set_collect_bang, shared: true do
before :each do
@set = Set[1, 2, 3, 4, 5]
end
it "yields each Object in self" do
res = []
@set.send(@method) { |x| res << x }
res.sort.should == [1, 2, 3, 4, 5].sort
end
it "returns self" do
@set.send(@method) { |x| x }.should equal(@set)
end
it "replaces self with the return values of the block" do
@set.send(@method) { |x| x * 2 }
@set.should == Set[2, 4, 6, 8, 10]
end
end

View file

@ -0,0 +1,15 @@
describe :set_difference, shared: true do
before :each do
@set = Set[:a, :b, :c]
end
it "returns a new Set containting self's elements excluding the elements in the passed Enumerable" do
@set.send(@method, Set[:a, :b]).should == Set[:c]
@set.send(@method, [:b, :c]).should == Set[:a]
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)
end
end

View file

@ -0,0 +1,7 @@
describe :set_include, shared: true do
it "returns true when self contains the passed Object" do
set = Set[:a, :b, :c]
set.send(@method, :a).should be_true
set.send(@method, :e).should be_false
end
end

View file

@ -0,0 +1,15 @@
describe :set_intersection, shared: true do
before :each do
@set = Set[:a, :b, :c]
end
it "returns a new Set containing only elements shared by self and the passed Enumerable" do
@set.send(@method, Set[:b, :c, :d, :e]).should == Set[:b, :c]
@set.send(@method, [:b, :c, :d]).should == Set[:b, :c]
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)
end
end

View file

@ -0,0 +1,6 @@
describe :set_length, shared: true do
it "returns the number of elements in the set" do
set = Set[:a, :b, :c]
set.send(@method).should == 3
end
end

View file

@ -0,0 +1,15 @@
describe :set_union, shared: true do
before :each do
@set = Set[:a, :b, :c]
end
it "returns a new Set containing all elements of self and the passed Enumerable" do
@set.send(@method, Set[:b, :d, :e]).should == Set[:a, :b, :c, :d, :e]
@set.send(@method, [:b, :e]).should == Set[:a, :b, :c, :e]
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)
end
end