Permalink
Browse files

use prepend_before for rails' test adapter

- Fixes #391.
- Needs to be released with or after addition of prepend_before to
  rspec-core.
  • Loading branch information...
1 parent dbcdcf7 commit 47907b3289fb2c783cb6a5b1c49c5000629dc2c4 @dchelimsky dchelimsky committed Mar 29, 2012
Showing with 18 additions and 1 deletion.
  1. +17 −0 features/controller_specs/controller_spec.feature
  2. +1 −1 lib/rspec/rails/adapters.rb
@@ -16,3 +16,20 @@ Feature: controller spec
"""
When I run `rspec spec`
Then the example should pass
+
+ Scenario: controller is exposed to global before hooks
+ Given a file named "spec/controllers/widgets_controller_spec.rb" with:
+ """
+ require "spec_helper"
+
+ RSpec.configure {|c| c.before { controller.should_not be_nil }}
+
+ describe WidgetsController do
+ describe "GET index" do
+ it "doesn't matter" do
+ end
+ end
+ end
+ """
+ When I run `rspec spec`
+ Then the example should pass
@@ -12,7 +12,7 @@ module ClassMethods
# Wraps `setup` calls from within Rails' testing framework in `before`
# hooks.
def setup(*methods)
- methods.each {|method| before { send method } }
+ methods.each {|method| prepend_before { send method } }
end
# @api private

0 comments on commit 47907b3

Please sign in to comment.