spec/controllers/users_controller_spec.rb in authenticate-0.3.1 vs spec/controllers/users_controller_spec.rb in authenticate-0.3.2
- old
+ new
@@ -24,18 +24,19 @@
get :new
expect(response).to redirect_to Authenticate.configuration.redirect_url
end
end
end
+
describe 'post to #create' do
context 'not signed in' do
context 'with valid attributes' do
let(:user_attributes) { attributes_for(:user) }
subject { post :create, user: user_attributes }
it 'creates user' do
- expect{ subject }.to change{ User.count }.by(1)
+ expect { subject }.to change { User.count }.by(1)
end
it 'assigned user' do
subject
expect(assigns(:user)).to be_present
@@ -53,11 +54,11 @@
end
let(:user_attributes) { attributes_for(:user) }
subject { post :create, user: user_attributes }
it 'creates user' do
- expect{ subject }.to change{ User.count }.by(1)
+ expect { subject }.to change { User.count }.by(1)
end
it 'assigned user' do
subject
expect(assigns(:user)).to be_present
@@ -66,17 +67,16 @@
it 'redirects to the redirect_url' do
subject
expect(response).to redirect_to '/url_in_the_session'
end
end
-
end
+
context 'signed in' do
it 'redirects to redirect_url' do
sign_in
post :create, user: {}
expect(response).to redirect_to Authenticate.configuration.redirect_url
end
end
end
-
end