Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spec/rails_helper.rb #512

Closed
wants to merge 5 commits into from
Closed

Add spec/rails_helper.rb #512

wants to merge 5 commits into from

Conversation

bobmazanec
Copy link
Contributor

'Add' spec/rails_helper.rb (by renaming spec_helper.rb) & generate spec/spec_helper.rb per http://www.relishapp.com/rspec/rspec-rails/docs/upgrade for RSpec Rails v3.1

Probably the most visible change is that RSpec automagically requires spec_helper into every spec; specs that require Rails be loaded (so most if not all in a Rails app) must

require 'rails_helper'

Perhaps the most visible functional change this introduces is the rspec:install-generator-default

mocks.verify_partial_doubles = true

which adds error-checking when mocking methods on 'real' objects
cf https://www.relishapp.com/rspec/rspec-mocks/docs/verifying-doubles/partial-doubles

per the "Upgrading an Existing App" / "I'm ready to just switch completely"
section of https://www.relishapp.com/rspec/rspec-rails/docs/upgrade
for RSpec Rails v3.1
per the "Upgrading an Existing App" / "I'm ready to just switch completely"
section of https://www.relishapp.com/rspec/rspec-rails/docs/upgrade
for RSpec Rails v3.1

If/when items in rails_helper.rb are needed by specs that don't
otherwise require Rails to be loaded, move those items from
rails_helper.rb into spec_helper.rb

The generator also overwrote .rspec;
merge in the one new useful line it had added
spec/spec_helper.rb was generated with
  mocks.verify_partial_doubles = true
causing Rspec to check mocked methods against the type being mocked

This led to warnings that...
  'true' does not support :lists
  '[]'   does not support :subscribe
@bobmazanec bobmazanec closed this Feb 4, 2015
@bobmazanec bobmazanec deleted the add_rails_helper branch February 4, 2015 17:43
@bobmazanec
Copy link
Contributor Author

Deleted my branch to rebase onto develop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant