Sha256: 6ada2ef7f2f0a85c4b9ac710956b0f88483117be1a8dbfd642e3779bb980dfb1

Contents?: true

Size: 616 Bytes

Versions: 1

Compression:

Stored size: 616 Bytes

Contents

require 'spec_helper'

global_assembly_set_up = lambda do
  AssemblyLine.define(:global_assembly) do
    let(:foo) { @bar +=1 }
    before do
      @bar = 0
    end
  end
  Assemble(:global_assembly)
end

def call_global_assembly(count = 5)
  (count - 1).times { foo }
  foo
end

describe "in the global context" do
  before(:all) do
    global_assembly_set_up.call
  end

  it "defined the method within AssemblyLine::GlobalContext" do
    AssemblyLine::GlobalContext.should respond_to(:foo)
  end

  it "does not increase the value because the method is memoized" do
    call_global_assembly.should == 1
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
assembly_line-0.2.0 spec/functional/global_context_spec.rb