Update specs to new rspec syntax
This commit is contained in:
@@ -23,14 +23,14 @@ describe API::ApplicationController do
|
||||
|
||||
it 'sets Access-Control-Allow-Methods header' do
|
||||
options :index
|
||||
response.headers['Access-Control-Allow-Methods'].should ==
|
||||
'GET, POST, PUT, DELETE'
|
||||
expect(response.headers['Access-Control-Allow-Methods'])
|
||||
.to eq 'GET, POST, PUT, DELETE'
|
||||
end
|
||||
|
||||
it 'sets Access-Control-Allow-Methods header' do
|
||||
options :index
|
||||
response.headers['Access-Control-Allow-Headers'].should ==
|
||||
'Content-Type, Content-Length, X-Requested-With'
|
||||
expect(response.headers['Access-Control-Allow-Headers'])
|
||||
.to eq 'Content-Type, Content-Length, X-Requested-With'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,8 +43,8 @@ describe API::ApplicationController do
|
||||
|
||||
it 'sets Access-Control-Allow-Origin header' do
|
||||
get :index
|
||||
response.headers['Access-Control-Allow-Origin']
|
||||
.should == request.headers['Origin']
|
||||
expect(response.headers['Access-Control-Allow-Origin'])
|
||||
.to eq request.headers['Origin']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -21,15 +21,15 @@ describe API::PlaylistsController do
|
||||
end
|
||||
|
||||
it 'lists all playlists' do
|
||||
do_get.should have(2).items
|
||||
expect(do_get).to have(2).items
|
||||
end
|
||||
|
||||
it 'lists playlists with their id' do
|
||||
do_get.each { |t| t.keys.should include 'id' }
|
||||
do_get.each { |t| expect(t.keys).to include 'id' }
|
||||
end
|
||||
|
||||
it 'lists playlists with their name' do
|
||||
do_get.each { |t| t.keys.should include 'name' }
|
||||
do_get.each { |t| expect(t.keys).to include 'name' }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -48,7 +48,7 @@ describe API::PlaylistsController do
|
||||
|
||||
it 'assigns the playlist' do
|
||||
do_create
|
||||
assigns[:playlist].should be_a Playlist
|
||||
expect(assigns[:playlist]).to be_a Playlist
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -17,31 +17,31 @@ describe API::SessionsController do
|
||||
end
|
||||
|
||||
it 'signs the user in' do
|
||||
controller.current_user.should == user
|
||||
expect(controller.current_user).to eq user
|
||||
end
|
||||
|
||||
it 'assigns the user' do
|
||||
assigns[:user].should == user
|
||||
expect(assigns[:user]).to eq user
|
||||
end
|
||||
end
|
||||
|
||||
[:email, :password].each do |attr|
|
||||
context "with invalid credentials (#{attr})" do
|
||||
before do
|
||||
user.stub(attr => user.send(attr) + '_INVALID')
|
||||
allow(user).to receive(attr).and_return(user.send(attr) + '_INVALID')
|
||||
do_create
|
||||
end
|
||||
|
||||
it 'returns a not found response' do
|
||||
response.should be_not_found
|
||||
expect(response).to be_not_found
|
||||
end
|
||||
|
||||
it 'returns an empty body' do
|
||||
response.body.should be_empty
|
||||
expect(response.body).to be_empty
|
||||
end
|
||||
|
||||
it 'assigns no user' do
|
||||
assigns[:user].should be_nil
|
||||
expect(assigns[:user]).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -21,19 +21,19 @@ describe API::TracksController do
|
||||
end
|
||||
|
||||
it 'lists all tracks' do
|
||||
do_get.should have(2).items
|
||||
expect(do_get).to have(2).items
|
||||
end
|
||||
|
||||
it 'lists tracks with their id' do
|
||||
do_get.each { |p| p.should include 'id' }
|
||||
do_get.each { |p| expect(p).to include 'id' }
|
||||
end
|
||||
|
||||
it 'lists tracks with their name' do
|
||||
do_get.each { |p| p.should include 'name' }
|
||||
do_get.each { |p| expect(p).to include 'name' }
|
||||
end
|
||||
|
||||
it 'lists tracks with sound URL' do
|
||||
do_get.each { |p| p.should include 'sound_url' }
|
||||
do_get.each { |p| expect(p).to include 'sound_url' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user