Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 53 lines (45 sloc) 1.351 kb
a6a35a6 @dchelimsky move top-level modules to RSpec::Rails namespace
dchelimsky authored
1 module RSpec::Rails
f504614 @dchelimsky words
dchelimsky authored
2 # Extends ActionDispatch::Integration::Runner to work with RSpec.
3 #
4 # == Matchers
5 #
6 # In addition to the stock matchers from rspec-expectations, request
7 # specs add these matchers, which delegate to rails' assertions:
8 #
9 # response.should render_template(*args)
10 # => delegates to assert_template(*args)
11 #
12 # response.should redirect_to(destination)
13 # => delegates to assert_redirected_to(destination)
a6a35a6 @dchelimsky move top-level modules to RSpec::Rails namespace
dchelimsky authored
14 module RequestExampleGroup
15 extend ActiveSupport::Concern
9910fed @dchelimsky Ensure that modules for different kind of specs get included in specs in
dchelimsky authored
16 extend RSpec::Rails::ModuleInclusion
84d448c @dchelimsky proper use of ActiveSupport::Concern
dchelimsky authored
17
a6a35a6 @dchelimsky move top-level modules to RSpec::Rails namespace
dchelimsky authored
18 include ActionDispatch::Integration::Runner
19 include RSpec::Rails::TestUnitAssertionAdapter
20 include ActionDispatch::Assertions
21 include Webrat::Matchers
22 include Webrat::Methods
23 include RSpec::Matchers
3def656 @dchelimsky expose render_template to view specs
dchelimsky authored
24 include RSpec::Rails::Matchers::RedirectTo
25 include RSpec::Rails::Matchers::RenderTemplate
cc43235 @dchelimsky add template assertions to request specs
dchelimsky authored
26 include ActionController::TemplateAssertions
a2e6107 @dchelimsky add request example group
dchelimsky authored
27
f25472e @dchelimsky move instance methods into InstanceMethods in modules that extend
dchelimsky authored
28 module InstanceMethods
29 def app
30 ::Rails.application
31 end
32
33 def last_response
34 response
35 end
36 end
37
a6a35a6 @dchelimsky move top-level modules to RSpec::Rails namespace
dchelimsky authored
38 included do
b3ab2bc @dchelimsky Add :type => :xxx to metadata for each specialized example group.
dchelimsky authored
39 metadata[:type] = :request
40
a6a35a6 @dchelimsky move top-level modules to RSpec::Rails namespace
dchelimsky authored
41 before do
42 @router = ::Rails.application.routes
43 end
d0dd096 @dchelimsky get example groups working w/ latest changes to rails head
dchelimsky authored
44
f25472e @dchelimsky move instance methods into InstanceMethods in modules that extend
dchelimsky authored
45 Webrat.configure do |config|
46 config.mode = :rack
47 end
a6a35a6 @dchelimsky move top-level modules to RSpec::Rails namespace
dchelimsky authored
48 end
17ee47c @dchelimsky clean up RequestExampleGroupBehaviour
dchelimsky authored
49
9910fed @dchelimsky Ensure that modules for different kind of specs get included in specs in
dchelimsky authored
50 RSpec.configure &include_self_when_dir_matches('spec','requests')
f06aa50 @dchelimsky add josé valim's rspec-rails generators
dchelimsky authored
51 end
a2e6107 @dchelimsky add request example group
dchelimsky authored
52 end
Something went wrong with that request. Please try again.