Sha256: f976207ec833ddb2a7d16d1acf0867c399bc3cb85551a6b7947f030eaece2070

Contents?: true

Size: 691 Bytes

Versions: 3

Compression:

Stored size: 691 Bytes

Contents

require 'action_dispatch'
require 'webrat'

module ControllerExampleGroupBehaviour
  include ActionDispatch::Assertions
  include ActionDispatch::Integration::Runner
  include Webrat::Matchers
  include Webrat::Methods
  include Rspec::Rails::Matchers

  def self.included(mod)
    mod.before { @_result = Struct.new(:add_assertion).new }
  end

  def app 
    self.class.described_class.action(@_action)
  end

  %w[get post put delete head].map do |method|
    eval <<-CODE
      def #{method}(action)
        @_action = action
        super '/'
      end
    CODE
  end

  Rspec::Core.configure do |c|
    c.include self, :behaviour => { :file_path => /\/spec\/controllers\// }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rspec-rails-2.0.0.a4 lib/rspec/rails/example/controller_example_group.rb
rspec-rails-2.0.0.a3 lib/rspec/rails/example/controller_example_group.rb
rspec-rails-2.0.0.a2 lib/rspec/rails/example/controller_example_group.rb