Refactor spec
This commit is contained in:
parent
a0d9c13772
commit
7412475891
|
@ -75,17 +75,22 @@ describe Draper::Base do
|
||||||
end
|
end
|
||||||
|
|
||||||
context ".decorate" do
|
context ".decorate" do
|
||||||
it "should return a collection of wrapped objects when given a collection of source objects" do
|
subject { Draper::Base.decorate(source) }
|
||||||
sources = [Product.new, Product.new]
|
|
||||||
output = Draper::Base.decorate(sources)
|
context "when given a collection of source objects" do
|
||||||
output.should respond_to(:each)
|
let(:source) { [Product.new, Product.new] }
|
||||||
output.size.should == sources.size
|
|
||||||
output.each{ |decorated| decorated.should be_instance_of(Draper::Base) }
|
its(:size) { should == source.size }
|
||||||
|
|
||||||
|
it "returns a collection of wrapped objects" do
|
||||||
|
subject.each{ |decorated| decorated.should be_instance_of(Draper::Base) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should return a single wrapped object when given a single source object" do
|
context "when given a single source object" do
|
||||||
output = Draper::Base.decorate(source)
|
let(:source) { Product.new }
|
||||||
output.should be_instance_of(Draper::Base)
|
|
||||||
|
it { should be_instance_of(Draper::Base) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue