Sha256: db68a59129d470215adf63ea7828b60ee2e27a0966b0d9ef5a38ee65a7256b96

Contents?: true

Size: 664 Bytes

Versions: 3

Compression:

Stored size: 664 Bytes

Contents

require "spec_helper"

describe Blocks::ViewAdditions do
  before(:each) do
    @view_class = Class.new
    @view = @view_class.new
    @view_class.send(:include, Blocks::ViewAdditions::ClassMethods)
  end

  describe "#blocks" do
    it "should pass the view as the only parameter to Blocks::Base initialization" do
      Blocks::Base.expects(:new).with {|view| view == @view}
      @view.blocks
    end

    it "should memoize the Blocks::Base instance for 'blocks' call" do
      Blocks::Base.expects(:new).once.with {|view| view == @view}.returns "something"
      @view.blocks.should eql "something"
      @view.blocks.should eql "something"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blocks-2.6.4 spec/blocks/view_additions_spec.rb
blocks-2.6.3 spec/blocks/view_additions_spec.rb
blocks-2.6.0 spec/blocks/view_additions_spec.rb