Update specs to new rspec syntax
This commit is contained in:
@@ -13,17 +13,17 @@ feature 'API sign in' do
|
||||
scenario 'signs the user in with valid credentials' do
|
||||
do_create
|
||||
|
||||
response.should be_success
|
||||
(JSON response.body).should include 'id'
|
||||
expect(response).to be_success
|
||||
expect(JSON response.body).to include 'id'
|
||||
end
|
||||
|
||||
[:email, :password].each do |attr|
|
||||
scenario "rejects authentication with invalid credentials (#{attr})" do
|
||||
user.stub(attr => user.send(attr) + '_INVALID')
|
||||
allow(user).to receive(attr).and_return(user.send(attr) + '_INVALID')
|
||||
do_create
|
||||
|
||||
response.should be_not_found
|
||||
response.body.should be_empty
|
||||
expect(response).to be_not_found
|
||||
expect(response.body).to be_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -22,12 +22,12 @@ feature 'API cross origin request' do
|
||||
{ 'Origin' => origin }
|
||||
)
|
||||
|
||||
response.headers['Access-Control-Allow-Origin'].should == origin
|
||||
response.headers['Access-Control-Allow-Credentials'].should == 'true'
|
||||
response.headers['Access-Control-Allow-Methods'].should ==
|
||||
'GET, POST, PUT, DELETE'
|
||||
response.headers['Access-Control-Allow-Headers'].should ==
|
||||
'Content-Type, Content-Length, X-Requested-With'
|
||||
expect(response.headers['Access-Control-Allow-Origin']).to eq origin
|
||||
expect(response.headers['Access-Control-Allow-Credentials']).to eq 'true'
|
||||
expect(response.headers['Access-Control-Allow-Methods'])
|
||||
.to eq 'GET, POST, PUT, DELETE'
|
||||
expect(response.headers['Access-Control-Allow-Headers'])
|
||||
.to eq 'Content-Type, Content-Length, X-Requested-With'
|
||||
end
|
||||
|
||||
scenario 'basic request' do
|
||||
@@ -36,15 +36,16 @@ feature 'API cross origin request' do
|
||||
'Origin' => origin
|
||||
}
|
||||
|
||||
response.headers['Access-Control-Allow-Origin'].should == origin
|
||||
response.headers['Access-Control-Allow-Credentials'].should == 'true'
|
||||
response.headers['Access-Control-Expose-Headers'].should == 'Content-Length'
|
||||
expect(response.headers['Access-Control-Allow-Origin']).to eq origin
|
||||
expect(response.headers['Access-Control-Allow-Credentials']).to eq 'true'
|
||||
expect(response.headers['Access-Control-Expose-Headers'])
|
||||
.to eq 'Content-Length'
|
||||
end
|
||||
|
||||
scenario 'request without origin' do
|
||||
# FIXME: replace with a more stable/generic action
|
||||
get api_playlists_path(format: :json)
|
||||
|
||||
response.headers['Access-Control-Allow-Origin'].should == ''
|
||||
expect(response.headers['Access-Control-Allow-Origin']).to eq ''
|
||||
end
|
||||
end
|
||||
|
@@ -16,7 +16,7 @@ feature 'API playlists' do
|
||||
|
||||
json = JSON response.body
|
||||
|
||||
json['id'].should be_a Fixnum
|
||||
json['name'].should == playlist[:name]
|
||||
expect(json['id']).to be_a Fixnum
|
||||
expect(json['name']).to eq playlist[:name]
|
||||
end
|
||||
end
|
||||
|
@@ -13,7 +13,7 @@ feature 'API tracks' do
|
||||
|
||||
get api_tracks_path, format: :json
|
||||
|
||||
response.body.should == [
|
||||
expect(response.body).to eq [
|
||||
{
|
||||
id: track_1.id,
|
||||
name: 'Track 1',
|
||||
|
Reference in New Issue
Block a user