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 :sorted_set_add, shared: true do
before :each do
@set = SortedSet.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 :sorted_set_collect_bang, shared: true do
before :each do
@set = SortedSet[1, 2, 3, 4, 5]
end
it "yields each Object in self in sorted order" do
res = []
SortedSet["one", "two", "three"].send(@method) { |x| res << x; x }
res.should == ["one", "two", "three"].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 == SortedSet[2, 4, 6, 8, 10]
end
end

View file

@ -0,0 +1,15 @@
describe :sorted_set_difference, shared: true do
before :each do
@set = SortedSet["a", "b", "c"]
end
it "returns a new SortedSet containting self's elements excluding the elements in the passed Enumerable" do
@set.send(@method, SortedSet["a", "b"]).should == SortedSet["c"]
@set.send(@method, ["b", "c"]).should == SortedSet["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 :sorted_set_include, shared: true do
it "returns true when self contains the passed Object" do
set = SortedSet["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 :sorted_set_intersection, shared: true do
before :each do
@set = SortedSet["a", "b", "c"]
end
it "returns a new SortedSet containing only elements shared by self and the passed Enumerable" do
@set.send(@method, SortedSet["b", "c", "d", "e"]).should == SortedSet["b", "c"]
@set.send(@method, ["b", "c", "d"]).should == SortedSet["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 :sorted_set_length, shared: true do
it "returns the number of elements in the set" do
set = SortedSet["a", "b", "c"]
set.send(@method).should == 3
end
end

View file

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