Skip to content
This repository
Browse code

get example groups working w/ latest changes to rails head

  • Loading branch information...
commit d0dd096c95edc2cc6c556ec43b2664751d40124e 1 parent a65fa0c
David Chelimsky dchelimsky authored
2  lib/generators/rspec/integration/templates/request_spec.rb
@@ -3,7 +3,7 @@
3 3 describe <%= class_name.pluralize %> do
4 4 describe "GET /<%= table_name %>" do
5 5 it "works! (now write some real specs)" do
6   - get "/<%= table_name %>"
  6 + get <%= table_name %>_path
7 7 end
8 8 end
9 9 end
7 lib/rspec/rails/example/controller_example_group.rb
@@ -6,6 +6,7 @@ module ControllerExampleGroupBehaviour
6 6 include ActionDispatch::Integration::Runner
7 7 include Webrat::Matchers
8 8 include Webrat::Methods
  9 + include Rspec::Matchers
9 10 include Rspec::Rails::Matchers
10 11
11 12 def self.included(mod)
@@ -13,7 +14,11 @@ def self.included(mod)
13 14 end
14 15
15 16 def app
16   - self.class.described_class.action(@_action)
  17 + self.class.described_class.action(@_action).tap do |endpoint|
  18 + def endpoint.routes
  19 + Rails.application.routes
  20 + end
  21 + end
17 22 end
18 23
19 24 %w[get post put delete head].map do |method|
8 lib/rspec/rails/example/request_example_group.rb
@@ -6,6 +6,7 @@ module RequestExampleGroupBehaviour
6 6 include ActionDispatch::Integration::Runner
7 7 include Webrat::Matchers
8 8 include Webrat::Methods
  9 + include Rspec::Rails::Matchers
9 10 Rails.application.routes.install_helpers(self)
10 11
11 12 def app
@@ -19,6 +20,13 @@ def app
19 20 def last_response
20 21 response
21 22 end
  23 +
  24 + def self.included(mod)
  25 + mod.before do
  26 + @_result = Struct.new(:add_assertion).new
  27 + @router = Rails.application.routes
  28 + end
  29 + end
22 30
23 31 Rspec.configure do |c|
24 32 c.include self, :example_group => { :file_path => /\bspec\/requests\// }
3  lib/rspec/rails/example/view_example_group.rb
@@ -46,7 +46,7 @@ def render
46 46 end
47 47
48 48 def method_missing(selector, *args)
49   - if ActionController::Routing::Routes.named_routes.helpers.include?(selector)
  49 + if Rails.application.routes.named_routes.helpers.include?(selector)
50 50 controller.__send__(selector, *args)
51 51 else
52 52 super
@@ -63,6 +63,7 @@ def controller
63 63 @controller ||= begin
64 64 controller = ViewExampleController.new
65 65 controller.controller_path = controller_path
  66 + controller.request = ActionDispatch::Request.new(Rack::MockRequest.env_for("/url"))
66 67 controller
67 68 end
68 69 end
2  rspec-rails.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9 9
10 10 s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11 11 s.authors = ["David Chelimsky", "Chad Humphries"]
12   - s.date = %q{2010-02-21}
  12 + s.date = %q{2010-02-27}
13 13 s.description = %q{Rspec-2 for Rails-3}
14 14 s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
15 15 s.extra_rdoc_files = [

0 comments on commit d0dd096

Please sign in to comment.
Something went wrong with that request. Please try again.