Sha256: 5c2a64b7298df5ece209cfe7b0111b7c6d39c0b1b15f00adafe6d39fdd0c3e52

Contents?: true

Size: 558 Bytes

Versions: 6

Compression:

Stored size: 558 Bytes

Contents

require 'spec_helper'

module Draper
  describe LazyHelpers do
    describe "#method_missing" do
      let(:decorator) do
        Struct.new(:helpers){include Draper::LazyHelpers}.new(double)
      end

      it "proxies methods to #helpers" do
        allow(decorator.helpers).to receive(:foo) { |arg| arg }
        expect(decorator.foo(:passed)).to be :passed
      end

      it "passes blocks" do
        allow(decorator.helpers).to receive(:foo) { |&block| block.call }
        expect(decorator.foo{:yielded}).to be :yielded
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
draper-4.0.2 spec/draper/lazy_helpers_spec.rb
draper-4.0.1 spec/draper/lazy_helpers_spec.rb
draper-4.0.0 spec/draper/lazy_helpers_spec.rb
draper-3.1.0 spec/draper/lazy_helpers_spec.rb
draper-3.0.1 spec/draper/lazy_helpers_spec.rb
draper-3.0.0 spec/draper/lazy_helpers_spec.rb