Permalink
Browse files

AssemblyLine specs

  • Loading branch information...
sandro committed Feb 4, 2010
1 parent 8d558e8 commit 073395b692ca742c3b6b71bd20a1e9dce0de9735
Showing with 31 additions and 0 deletions.
  1. +31 −0 spec/assembly_line_spec.rb
View
@@ -15,4 +15,35 @@
AssemblyLine.define(:user_with_address, &definition)
end
end
+
+ describe ".assemble" do
+ let(:rspec_context) { mock('rspec context') }
+
+ context "cannot locate the AssemblyLine" do
+ it "raises an error" do
+ expect do
+ AssemblyLine.assemble(:does_not_exist, rspec_context)
+ end.to raise_error(ArgumentError)
+ end
+ end
+
+ context "AssemblyLine exists" do
+ it "assembles the AssemblyLine" do
+ constructor = mock('constructor')
+ constructor.should_receive(:assemble).with(rspec_context, options)
+ AssemblyLine::Registry.stub(:locate => constructor)
+ AssemblyLine.assemble(:party, rspec_context)
+ end
+ end
+ end
+
+ describe "#Assemble" do
+ it "delegates to AssemblyLine.assemble" do
+ klass = Class.new do
+ extend AssemblyLine
+ end
+ AssemblyLine.should_receive(:assemble).with(:party, klass, {})
+ klass.Assemble(:party)
+ end
+ end
end

0 comments on commit 073395b

Please sign in to comment.