Created
July 11, 2013 22:24
-
-
Save IdahoEv/5979788 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe RegistrationsController do | |
before :each do | |
request.env['devise.mapping'] = Devise.mappings[:user] | |
end | |
steps "create" do | |
render_views | |
let :valid_params do | |
{ :first_name => "Jane", | |
:last_name => "Public", | |
:email => "[email protected]", | |
:website => 'http://foo.com', | |
:password => ::TEST_PASSWORD, | |
:password_confirmation => ::TEST_PASSWORD, | |
:agreed_to_terms => '1' | |
} | |
end | |
it "should create a user and publisher" do | |
expect do | |
expect do | |
post :create, :user => valid_params | |
end.to change{ User.count }.by(1) | |
end.to change{ Publisher.count }.by(1) | |
end | |
it "should make the user an admin of the publisher" do | |
assigns[:user].should be_admin_of(assigns[:publisher]) | |
end | |
it "should create a valid user" do | |
assigns[:user].should be_valid | |
end | |
it "should redirect" do | |
response.should redirect_to(campaigns_path) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get "undefined method 'valid?' for nil:NilClass" on line 35. Given that I don't get an error on line 31, i don't see how this is possible.