Sha256: 0d83dfb834974160d35d018a890ad40df9998b8df76d05c7107ec8b401d9da0b

Contents?: true

Size: 855 Bytes

Versions: 5

Compression:

Stored size: 855 Bytes

Contents

require "spec_helper"

describe MobileEnhancements::HelperDelegation do
  let(:request) { mock(:request) }
  
  subject do
    Class.new do
      def self.helper_method(*helpers)
        @helpers ||= []
        @helpers += helpers.flatten
      end
      
      def self.helper_methods
        @helpers || []
      end
      
      include MobileEnhancements::HelperDelegation
    end.new.tap do |inst|
      inst.stub(:request).and_return(request)
    end
  end
  
  MobileEnhancements::RequestHelper.delegated_methods.each do |method|
    it "should delegate ##{method} to RequestHelper" do
      subject.send(:mobile_enhancement_helpers).should_receive(method).and_return(true)
      subject.send(method)
    end
    
    it "should define ##{method} as a helper method" do
      expect(subject.class.helper_methods).to include method
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mobile-enhancements-0.0.5 spec/mobile_enhancements/helper_delegation_spec.rb
mobile-enhancements-0.0.4 spec/mobile_enhancements/helper_delegation_spec.rb
mobile-enhancements-0.0.3 spec/mobile_enhancements/helper_delegation_spec.rb
mobile-enhancements-0.0.2 spec/mobile_enhancements/helper_delegation_spec.rb
mobile-enhancements-0.0.1 spec/mobile_enhancements/helper_delegation_spec.rb