Sha256: 266700e33ae055d4b8f442943609016cb76a55649e9e0af306714273b7d6f4ea
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require 'action_dispatch' require 'webrat' # Preliminary documentation (more to come ....): # # allow_forgery_protection is set to false # - you can set it to true in a before(:each) block # if you have a specific example that needs it, but # be sure to restore it to false (or supply tokens # to all of your example requests) 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 do @_result = Struct.new(:add_assertion).new ActionController::Base.allow_forgery_protection = false end end def app described_class.action(@_action).tap do |endpoint| def endpoint.routes Rails.application.routes end end end %w[get post put delete head].map do |method| eval <<-CODE def #{method}(*args) @_action = args.shift super '/', *args end CODE end Rspec.configure do |c| c.include self, :example_group => { :file_path => /\bspec\/controllers\// } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspec-rails-2.0.0.beta.4 | lib/rspec/rails/example/controller_example_group.rb |
rspec-rails-2.0.0.beta.3 | lib/rspec/rails/example/controller_example_group.rb |