diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-08-30 19:10:53 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-08-30 19:12:55 -0400 |
commit | 77053a6c217e06770a348ac989992afbd41697f6 (patch) | |
tree | 11df50675162be2045777c1f59c312d359e0d6cf /spec/requests/api/triggers_spec.rb | |
parent | 74b995d17b095e326177e7c0e452f0df3a1ab885 (diff) | |
download | gitlab-ci-rs-rspec3.tar.gz |
Convert to RSpec3 syntax via transpecrs-rspec3
Command:
transpec -c 'bundle exec rspec spec -t ~feature' \
-o should,oneliner,should_receive
Diffstat (limited to 'spec/requests/api/triggers_spec.rb')
-rw-r--r-- | spec/requests/api/triggers_spec.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/requests/api/triggers_spec.rb b/spec/requests/api/triggers_spec.rb index fc7394c..e477a59 100644 --- a/spec/requests/api/triggers_spec.rb +++ b/spec/requests/api/triggers_spec.rb @@ -17,17 +17,17 @@ describe API::API do context 'Handles errors' do it 'should return bad request if token is missing' do post api("/projects/#{project.id}/refs/master/trigger") - response.status.should eq 400 + expect(response.status).to eq 400 end it 'should return not found if project is not found' do post api('/projects/0/refs/master/trigger'), options - response.status.should eq 404 + expect(response.status).to eq 404 end it 'should return unauthorized if token is for different project' do post api("/projects/#{project2.id}/refs/master/trigger"), options - response.status.should eq 401 + expect(response.status).to eq 401 end end @@ -38,15 +38,15 @@ describe API::API do it 'should create builds' do post api("/projects/#{project.id}/refs/master/trigger"), options - response.status.should eq 201 + expect(response.status).to eq 201 @commit.builds.reload - @commit.builds.size.should eq 2 + expect(@commit.builds.size).to eq 2 end it 'should return bad request with no builds created if there\'s no commit for that ref' do post api("/projects/#{project.id}/refs/other-branch/trigger"), options - response.status.should eq 400 - json_response['message'].should eq 'No builds created' + expect(response.status).to eq 400 + expect(json_response['message']).to eq 'No builds created' end context 'Validates variables' do @@ -56,21 +56,21 @@ describe API::API do it 'should validate variables to be a hash' do post api("/projects/#{project.id}/refs/master/trigger"), options.merge(variables: 'value') - response.status.should eq 400 - json_response['message'].should eq 'variables needs to be a hash' + expect(response.status).to eq 400 + expect(json_response['message']).to eq 'variables needs to be a hash' end it 'should validate variables needs to be a map of key-valued strings' do post api("/projects/#{project.id}/refs/master/trigger"), options.merge(variables: {key: %w(1 2)}) - response.status.should eq 400 - json_response['message'].should eq 'variables needs to be a map of key-valued strings' + expect(response.status).to eq 400 + expect(json_response['message']).to eq 'variables needs to be a map of key-valued strings' end it 'create trigger request with variables' do post api("/projects/#{project.id}/refs/master/trigger"), options.merge(variables: variables) - response.status.should eq 201 + expect(response.status).to eq 201 @commit.builds.reload - @commit.builds.first.trigger_request.variables.should eq variables + expect(@commit.builds.first.trigger_request.variables).to eq variables end end end |