Skip to content

Commit

Permalink
Spec style.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Oct 10, 2011
1 parent c6abf66 commit 136723e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion spec/cartesian_product/mixin_examples.rb
Expand Up @@ -12,7 +12,7 @@

it "the cartprod of two empty Set's should return an empty Set" do
set = subject[[]]
results = set.cartprod([[]])
results = set.cartprod([[]]).to_a

results.should be_empty
end
Expand Down
39 changes: 22 additions & 17 deletions spec/permute/mixin_examples.rb
Expand Up @@ -4,40 +4,45 @@

shared_examples_for "Permute::Mixin" do
it "should alias rearrange to permute" do
aset = subject[1]
set = subject[1]

aset.should respond_to(:rearrange)
set.should respond_to(:rearrange)
end

describe "#permute" do
it "should return [[]] for [].permute(0).to_a" do
aset = subject[[]]

aset.permute(0).to_a.should == [[]]
set = subject[[]]
results = set.permute(0).to_a

results.should == [[]]
end

it "should return [[]] for [1].permute(0).to_a" do
aset = subject[[1]]

aset.permute(0).to_a.should == [[]]
set = subject[[1]]
results = set.permute(0).to_a

results.should == [[]]
end

it "should return [[1]] for [1].permute(1).to_a" do
aset = subject[1]

aset.permute(1).to_a.should == [[1]]
set = subject[1]
results = set.permute(1).to_a

results.should == [[1]]
end

it "should return [[1], [2]] for [1, 2].permute(1).to_a" do
aset = subject[1, 2]

aset.permute(1).to_a.should == [[1], [2]]
set = subject[1, 2]
results = set.permute(1).to_a

results.should == [[1], [2]]
end

it "should return [[1, 2]] for [1, 2].permute(2).to_a" do
aset = subject[1, 2]

aset.permute(2).to_a.should == [[1, 2], [2, 1]]
set = subject[1, 2]
results = set.permute(2).to_a

results.should == [[1, 2], [2, 1]]
end
end
end

0 comments on commit 136723e

Please sign in to comment.