Sha256: 58c568e83226034231d1f1ea27510a85178437d1d22ae9a3938875e99d730a40

Contents?: true

Size: 809 Bytes

Versions: 1

Compression:

Stored size: 809 Bytes

Contents

PageModels::Base.send(:include, RSpec::Matchers)

module PageModels
  module RSpecIntegration
    def open_page(page_model)
      page_model = page_model.new if page_model.is_a? Class
      $page_model = page_model
      page_model.open!
    end
    
    def should_see_page(page_model)
      page_model = page_model.new if page_model.is_a? Class      
      $page_model = page_model
      page_model.verify!
    end
    
  end
  
  module PageModelMethodDelegation
    def method_missing(name, *args, &block)
      if $page_model && $page_model.respond_to?(name)
        $page_model.send(name, *args, &block) 
      else
        super(name, *args, &block)
      end
    end
  end
end

Object.send(:include, PageModels::RSpecIntegration)
RSpec.configure { |c| c.include PageModels::PageModelMethodDelegation }

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pagemodels-0.2.0 lib/page_models/integration/rspec.rb