-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Specifying global before :all
hooks for specified :type
does not work with rspec-rails
version 2.14.0
.
Here's how to reproduce it:
- generate an empty project
> rails -v
Rails 4.0.0
> rails new rspec-rails-broken
create
create README.rdoc
create Rakefile
create config.ru
...
- add rspec-rails into Gemfile:
# Gemfile
group :development, :test do
gem 'rspec-rails', '2.14.0'
end
- setup it:
> bundle install
> rails g rspec:install
- add a
before
hook with specific type intospec_helper
:
RSpec.configure do |config|
config.before :all, type: :request do
raise "should fail!"
end
end
- create a
request
spec:
# spec/requests/failing_spec.rb
require "spec_helper"
describe "always failing" do
it "should fail" do
end
end
- execute the spec and hope for failure:
> bundle exec rake db:migrate spec
ruby -S rspec ./spec/requests/failing_spec.rb
.
Finished in 0.002 seconds
1 example, 0 failures
- the spec did not fail! This is because that
before :all
got not executed. The same happens when using differenttype
-controller
for example forspec/controllers/*_spec.rb
.
It will work as inspected if using before :each
instead or if downgrading to 2.13.2
Metadata
Metadata
Assignees
Labels
No labels