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
1 changed files with 3 additions and 3 deletions

View File

@ -1248,7 +1248,7 @@ describe UsersController do
describe '.check_emails' 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
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
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
end
it "returns both email and associated_accounts when you're allowed to see them" do
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
json = JSON.parse(response.body)
json["email"].should be_present