Sha256: 5617857eaec8fe11bc651d8c22784c2853c4e2b46d1179595f371bac06dfb711

Contents?: true

Size: 509 Bytes

Versions: 1

Compression:

Stored size: 509 Bytes

Contents

require 'spec_helper'

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

describe "in the global context" do
  before do
    set_up_assembly.call
  end

  it "defines the method on AssemblyLine.generic_context" do
    AssemblyLine.generic_context.should respond_to(:foo)
  end

  it "memoizes the value" do
    5.times { AssemblyLine.foo }
    AssemblyLine.foo.should == 1
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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