README.md in assembly_line-0.1.0 vs README.md in assembly_line-0.2.0

- old
+ new

@@ -18,20 +18,27 @@ config.extend AssemblyLine end Define an AssemblyLine - Assembly.define(:user_with_payment_address) do + AssemblyLine.define(:user_with_payment_address) do let(:user) { Factory(:user)} let(:payment_address) { Factory(:payment_address, :user => user) } end Example ------- -Place your AssemblyLine definitions in *spec/support/assemblies.rb* +### Place your AssemblyLine definitions in *spec/support/assemblies.rb* + class Party < Struct.new(:host, :attendees) + attr_writer :drinks + def drinks + @drinks ||= [] + end + end + AssemblyLine.define(:drinks) do let(:drinks) { [:gin, :vodka] } end AssemblyLine.define(:party) do @@ -41,11 +48,11 @@ let(:attendees) { [:nick, :ellis, :coach] } let(:party) { @party = Party.new(host, attendees) } let(:party_crasher) { attendees << :crasher; :crasher } end -Use your AssemblyLine in a test +### Use your AssemblyLine in a test describe "README example" do context "attendees" do Assemble(:party) @@ -68,9 +75,17 @@ it "does not include the list of standard drinks" do party.drinks.should_not include(drinks) end end end + +### Use your AssemblyLine in an irb session + + >> Assemble(:drinks) + => #<AssemblyLine::Constructor:0x10049e958 @code_block=#<Proc:0x000000010049ea98@(irb):1>, @name=:drinks, @rspec_context=AssemblyLine::GlobalContext, @options={}> + >> drinks + => [:gin, :vodka] + Thanks! ------- - l4rk (initial spike declaring modules and including them in the rspec context)