use the right HTTP verb

This commit is contained in:
Régis Hanol 2014-09-29 22:41:54 +02:00
parent 7e309a21cf
commit a7a1dcadcc

View file

@ -1248,7 +1248,7 @@ describe UsersController do
describe '.check_emails' do describe '.check_emails' do
it 'raises an error when not logged in' do it 'raises an error when not logged in' do
lambda { xhr :get, :check_emails, username: 'zogstrip' }.should raise_error(Discourse::NotLoggedIn) lambda { xhr :put, :check_emails, username: 'zogstrip' }.should raise_error(Discourse::NotLoggedIn)
end end
context 'while logged in' do context 'while logged in' do
@ -1256,13 +1256,13 @@ describe UsersController do
it "raises an error when you aren't allowed to check emails" do it "raises an error when you aren't allowed to check emails" do
Guardian.any_instance.expects(:can_check_emails?).returns(false) Guardian.any_instance.expects(:can_check_emails?).returns(false)
xhr :get, :check_emails, username: Fabricate(:user).username xhr :put, :check_emails, username: Fabricate(:user).username
response.should be_forbidden response.should be_forbidden
end end
it "returns both email and associated_accounts when you're allowed to see them" do it "returns both email and associated_accounts when you're allowed to see them" do
Guardian.any_instance.expects(:can_check_emails?).returns(true) Guardian.any_instance.expects(:can_check_emails?).returns(true)
xhr :get, :check_emails, username: Fabricate(:user).username xhr :put, :check_emails, username: Fabricate(:user).username
response.should be_success response.should be_success
json = JSON.parse(response.body) json = JSON.parse(response.body)
json["email"].should be_present json["email"].should be_present