spec/controllers/refinery/authentication/devise/admin/users_controller_spec.rb in refinerycms-authentication-devise-1.0.4 vs spec/controllers/refinery/authentication/devise/admin/users_controller_spec.rb in refinerycms-authentication-devise-2.0.0
- old
+ new
@@ -32,31 +32,31 @@
describe "#create" do
it "creates a new user with valid params" do
user = Refinery::Authentication::Devise::User.new :username => "bob"
expect(user).to receive(:save).once{ true }
expect(Refinery::Authentication::Devise::User).to receive(:new).once.with(instance_of(ActionController::Parameters)){ user }
- post :create, :user => {:username => 'bobby'}
+ post :create, params: { user: { username: 'bobby' } }
expect(response).to be_redirect
end
it_should_behave_like "new, create, update, edit and update actions"
it "re-renders #new if there are errors" do
user = Refinery::Authentication::Devise::User.new :username => "bob"
expect(user).to receive(:save).once{ false }
expect(Refinery::Authentication::Devise::User).to receive(:new).once.with(instance_of(ActionController::Parameters)){ user }
- post :create, :user => {:username => 'bobby'}
+ post :create, params: { user: { username: 'bobby' } }
expect(response).to be_success
expect(response).to render_template("refinery/authentication/devise/admin/users/new")
end
end
describe "#edit" do
refinery_login_with_devise [:refinery, :superuser]
it "renders the edit template" do
- get :edit, :id => logged_in_user.id
+ get :edit, params: { id: logged_in_user.id }
expect(response).to be_success
expect(response).to render_template("refinery/authentication/devise/admin/users/edit")
end
it_should_behave_like "new, create, update, edit and update actions"
@@ -65,24 +65,24 @@
describe "#update" do
refinery_login_with_devise [:refinery, :superuser]
let(:additional_user) { FactoryGirl.create :authentication_devise_refinery_user }
it "updates a user" do
- patch "update", :id => additional_user.id.to_s, :user => {:username => 'bobby'}
+ patch :update, params: { id: additional_user.id.to_s, user: { username: 'bobby' } }
expect(response).to be_redirect
end
context "when specifying plugins" do
it "won't allow to remove 'Users' plugin from self" do
- patch "update", :id => logged_in_user.id.to_s, :user => {:plugins => ["some plugin"]}
+ patch :update, params: { id: logged_in_user.id.to_s, user: { plugins: ["some plugin"] } }
expect(flash[:error]).to eq("You cannot remove the 'Users' plugin from the currently logged in account.")
end
it "will update to the plugins supplied" do
expect(logged_in_user).to receive(:update_attributes).with({"plugins" => %w(refinery_authentication_devise some_plugin)})
allow(Refinery::Authentication::Devise::User).to receive_message_chain(:includes, :find) { logged_in_user }
- patch "update", :id => logged_in_user.id.to_s, :user => {:plugins => %w(refinery_authentication_devise some_plugin)}
+ patch :update, params: { id: logged_in_user.id.to_s, user: { plugins: %w(refinery_authentication_devise some_plugin) } }
end
end
it_should_behave_like "new, create, update, edit and update actions"
end