Remove controllers spec already tested elsewhere

This commit is contained in:
Thibault Jouan
2015-05-01 14:11:11 +00:00
parent 5e1757aff9
commit 896fe661bd
15 changed files with 64 additions and 478 deletions

View File

@@ -1,5 +1,7 @@
describe 'API sign in' do
let(:user) { FactoryGirl.create(:user) }
include AcceptanceHelpers
let(:user) { create :user }
def do_create
post api_sessions_path, format: :json, session: {
@@ -11,17 +13,20 @@ describe 'API sign in' do
it 'signs the user in with valid credentials' do
do_create
expect(response).to be_success
expect(JSON response.body).to include 'id'
expect(json).to eq({
id: user.id
})
end
[:email, :password].each do |attr|
it "rejects authentication with invalid credentials (#{attr})" do
allow(user).to receive(attr).and_return(user.send(attr) + '_INVALID')
do_create
context "with invalid #{attr}" do
it 'rejects authentication' do
allow(user).to receive(attr).and_return(user.send(attr) + '_INVALID')
do_create
expect(response).to be_not_found
expect(response.body).to be_empty
expect(response).to be_not_found
expect(response.body).to be_empty
end
end
end
end