Sha256: 53c7170ea77f1e411e8b281ca10a05372d18c3298a42b1d8ae34d4b80dd656fd

Contents?: true

Size: 670 Bytes

Versions: 8

Compression:

Stored size: 670 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 method" 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

8 entries across 8 versions & 1 rubygems

Version Path
blocks-2.5.1 spec/blocks/view_additions_spec.rb
blocks-2.5.0 spec/blocks/view_additions_spec.rb
blocks-2.4.0 spec/blocks/view_additions_spec.rb
blocks-2.3.1 spec/blocks/view_additions_spec.rb
blocks-2.3.0 spec/blocks/view_additions_spec.rb
blocks-2.2.1 spec/blocks/view_additions_spec.rb
blocks-2.2.0 spec/blocks/view_additions_spec.rb
blocks-2.1.0 spec/blocks/view_additions_spec.rb