Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rspec/rspec-rails
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.10.0
Choose a base ref
...
head repository: rspec/rspec-rails
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.10.1
Choose a head ref
  • 4 commits
  • 6 files changed
  • 1 contributor

Commits on May 5, 2012

  1. Only prepend_before the Rails setup methods

    - Fixes #534
    - Unfortunately depends on names of methods that are internal to Rails
      and subject to change. Fingers crossed.
    dchelimsky committed May 5, 2012

    Verified

    This commit was signed with the committer’s verified signature.
    flavorjones Mike Dalessio
    Copy the full SHA
    71006ce View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    flavorjones Mike Dalessio
    Copy the full SHA
    4f179c4 View commit details
  3. Verified

    This commit was signed with the committer’s verified signature.
    flavorjones Mike Dalessio
    Copy the full SHA
    b6e3ae3 View commit details
  4. bump to 2.10.1

    dchelimsky committed May 5, 2012

    Verified

    This commit was signed with the committer’s verified signature.
    flavorjones Mike Dalessio
    Copy the full SHA
    63a9efd View commit details
Showing with 51 additions and 4 deletions.
  1. +8 −0 Changelog.md
  2. +1 −0 Gemfile
  3. +8 −2 lib/rspec/rails/adapters.rb
  4. +1 −1 lib/rspec/rails/version.rb
  5. +1 −1 rspec-rails.gemspec
  6. +32 −0 spec/rspec/rails/setup_and_teardown_adapter_spec.rb
8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### 2.10.1 / 2012-05-03
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.10.0...v2.10.1)

Bug fixes

* fix regression introduced in 2.10.0 that broke integration with Devise
(https://github.com/rspec/rspec-rails/issues/534)

### 2.10.0 / 2012-05-03
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.9.0...v2.10.0)

1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ when /master/
gem "rails", :git => "git://github.com/rails/rails.git"
gem "arel", :git => "git://github.com/rails/arel.git"
gem "journey", :git => "git://github.com/rails/journey.git"
gem "active_record_deprecated_finders", :git => "git://github.com/rails/active_record_deprecated_finders.git"
when /3-0-stable/
gem "rails", :git => "git://github.com/rails/rails.git", :branch => "3-0-stable"
gem "arel", :git => "git://github.com/rails/arel.git", :branch => "2-0-stable"
10 changes: 8 additions & 2 deletions lib/rspec/rails/adapters.rb
Original file line number Diff line number Diff line change
@@ -12,15 +12,21 @@ module ClassMethods
# Wraps `setup` calls from within Rails' testing framework in `before`
# hooks.
def setup(*methods)
methods.each {|method| prepend_before { send method } }
methods.each do |method|
if method.to_s =~ /^setup_(fixtures|controller_request_and_response)$/
prepend_before { send method }
else
before { send method }
end
end
end

# @api private
#
# Wraps `teardown` calls from within Rails' testing framework in
# `after` hooks.
def teardown(*methods)
methods.each {|method| after { send method } }
methods.each { |method| after { send method } }
end
end

2 changes: 1 addition & 1 deletion lib/rspec/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module RSpec
module Rails
module Version
STRING = '2.10.0'
STRING = '2.10.1'
end
end
end
2 changes: 1 addition & 1 deletion rspec-rails.gemspec
Original file line number Diff line number Diff line change
@@ -34,5 +34,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'cucumber', '~> 1.1.9'
s.add_development_dependency 'aruba', '~> 0.4.11'
s.add_development_dependency 'ZenTest', '4.6.2'
s.add_development_dependency 'ammeter', '0.2.4'
s.add_development_dependency 'ammeter', '0.2.5'
end
32 changes: 32 additions & 0 deletions spec/rspec/rails/setup_and_teardown_adapter_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require 'spec_helper'

describe RSpec::Rails::SetupAndTeardownAdapter do
describe "::setup" do
it "registers before hooks in the order setup is received" do
klass = Class.new do
include RSpec::Rails::SetupAndTeardownAdapter
def self.foo; "foo"; end
def self.bar; "bar"; end
end
klass.should_receive(:before).ordered { |&block| block.call.should eq "foo" }
klass.should_receive(:before).ordered { |&block| block.call.should eq "bar" }

klass.setup :foo
klass.setup :bar
end

it "registers prepend_before hooks for the Rails' setup methods" do
klass = Class.new do
include RSpec::Rails::SetupAndTeardownAdapter
def self.setup_fixtures; "setup fixtures" end
def self.setup_controller_request_and_response; "setup controller" end
end

klass.should_receive(:prepend_before) { |&block| block.call.should eq "setup fixtures" }
klass.should_receive(:prepend_before) { |&block| block.call.should eq "setup controller" }

klass.setup :setup_fixtures
klass.setup :setup_controller_request_and_response
end
end
end