|
2 | 2 |
|
3 | 3 | RSpec.describe Codeship::Status do |
4 | 4 | context 'parsing the project status' do |
5 | | - Codeship::Status::STATES.each do |state| |
6 | | - it "should parse #{state}" do |
| 5 | + context 'of a project with completed build' do |
| 6 | + Codeship::Status::STATES.each do |state| |
| 7 | + it "should parse #{state}" do |
7 | 8 |
|
8 | | - stub_request(:head, "https://codeship.com/projects/#{state}/status"). |
9 | | - with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}). |
10 | | - to_return(status: 200, body: "", headers: {'Content-Disposition' => "inline; filename=\"status_#{state}.png\""}) |
| 9 | + stub_request(:head, "https://codeship.com/projects/#{state}/status"). |
| 10 | + with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}). |
| 11 | + to_return(status: 200, body: "", headers: {'Content-Disposition' => "inline; filename=\"status_#{state}.png\""}) |
11 | 12 |
|
12 | | - project_status = Codeship::Status.new(state) |
13 | | - expect(project_status.status).to eq(state) |
| 13 | + project_status = Codeship::Status.new(state) |
| 14 | + expect(project_status.status).to eq(state) |
| 15 | + end |
| 16 | + end |
| 17 | + end |
| 18 | + |
| 19 | + context 'of a project with active build' do |
| 20 | + Codeship::Status::STATES.each do |state| |
| 21 | + it "should parse #{state}" do |
| 22 | + |
| 23 | + stub_request(:head, "https://codeship.com/projects/#{state}/status"). |
| 24 | + with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}). |
| 25 | + to_return(status: 200, body: "", headers: {'Content-Disposition' => "inline; filename=\"status_#{state}.gif\""}) |
| 26 | + |
| 27 | + project_status = Codeship::Status.new(state) |
| 28 | + expect(project_status.status).to eq(state) |
| 29 | + end |
14 | 30 | end |
15 | 31 | end |
16 | 32 | end |
17 | 33 |
|
18 | 34 | context 'parsing the project status on a certain branch' do |
19 | | - Codeship::Status::STATES.each do |state| |
20 | | - it "should parse #{state}" do |
21 | | - stub_request(:head, "https://codeship.com/projects/#{state}/status?branch=master"). |
22 | | - with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}). |
23 | | - to_return(status: 200, body: "", headers: {'Content-Disposition' => "inline; filename=\"status_#{state}.png\""}) |
24 | | - |
25 | | - project_status = Codeship::Status.new(state, branch: 'master') |
26 | | - expect(project_status.status).to eq(state) |
| 35 | + context 'of a project with completed build' do |
| 36 | + Codeship::Status::STATES.each do |state| |
| 37 | + it "should parse #{state}" do |
| 38 | + stub_request(:head, "https://codeship.com/projects/#{state}/status?branch=master"). |
| 39 | + with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}). |
| 40 | + to_return(status: 200, body: "", headers: {'Content-Disposition' => "inline; filename=\"status_#{state}.png\""}) |
| 41 | + |
| 42 | + project_status = Codeship::Status.new(state, branch: 'master') |
| 43 | + expect(project_status.status).to eq(state) |
| 44 | + end |
| 45 | + end |
| 46 | + end |
| 47 | + |
| 48 | + context 'of a project with active build' do |
| 49 | + Codeship::Status::STATES.each do |state| |
| 50 | + it "should parse #{state}" do |
| 51 | + stub_request(:head, "https://codeship.com/projects/#{state}/status?branch=master"). |
| 52 | + with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}). |
| 53 | + to_return(status: 200, body: "", headers: {'Content-Disposition' => "inline; filename=\"status_#{state}.gif\""}) |
| 54 | + |
| 55 | + project_status = Codeship::Status.new(state, branch: 'master') |
| 56 | + expect(project_status.status).to eq(state) |
| 57 | + end |
27 | 58 | end |
28 | 59 | end |
29 | 60 | end |
|
0 commit comments