|
2 | 2 |
|
3 | 3 | RSpec.describe Codeship::Status do |
4 | 4 | context 'parsing the project status' do |
5 | | - context 'of a project with completed build' do |
| 5 | + context 'which returns a png' do |
6 | 6 | Codeship::Status::STATES.each do |state| |
7 | 7 | it "should parse #{state}" do |
8 | 8 |
|
|
16 | 16 | end |
17 | 17 | end |
18 | 18 |
|
19 | | - context 'of a project with active build' do |
| 19 | + context 'which returns a gif' do |
20 | 20 | Codeship::Status::STATES.each do |state| |
21 | 21 | it "should parse #{state}" do |
22 | 22 |
|
|
29 | 29 | end |
30 | 30 | end |
31 | 31 | end |
| 32 | + |
| 33 | + context 'which returns a svg' do |
| 34 | + Codeship::Status::STATES.each do |state| |
| 35 | + it "should parse #{state}" do |
| 36 | + |
| 37 | + stub_request(:head, "https://app.codeship.com/projects/#{state}/status"). |
| 38 | + with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}). |
| 39 | + to_return(status: 200, body: "", headers: {'Content-Disposition' => "inline; filename=\"status_#{state}.svg\""}) |
| 40 | + |
| 41 | + project_status = Codeship::Status.new(state) |
| 42 | + expect(project_status.status).to eq(state) |
| 43 | + end |
| 44 | + end |
| 45 | + end |
32 | 46 | end |
33 | 47 |
|
34 | 48 | context 'parsing the project status on a certain branch' do |
35 | | - context 'of a project with completed build' do |
| 49 | + context 'which returns a png' do |
36 | 50 | Codeship::Status::STATES.each do |state| |
37 | 51 | it "should parse #{state}" do |
| 52 | + |
38 | 53 | stub_request(:head, "https://app.codeship.com/projects/#{state}/status?branch=master"). |
39 | 54 | with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}). |
40 | 55 | to_return(status: 200, body: "", headers: {'Content-Disposition' => "inline; filename=\"status_#{state}.png\""}) |
|
45 | 60 | end |
46 | 61 | end |
47 | 62 |
|
48 | | - context 'of a project with active build' do |
| 63 | + context 'which returns a gif' do |
49 | 64 | Codeship::Status::STATES.each do |state| |
50 | 65 | it "should parse #{state}" do |
| 66 | + |
51 | 67 | stub_request(:head, "https://app.codeship.com/projects/#{state}/status?branch=master"). |
52 | 68 | with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}). |
53 | 69 | to_return(status: 200, body: "", headers: {'Content-Disposition' => "inline; filename=\"status_#{state}.gif\""}) |
|
57 | 73 | end |
58 | 74 | end |
59 | 75 | end |
| 76 | + |
| 77 | + context 'which returns a svg' do |
| 78 | + Codeship::Status::STATES.each do |state| |
| 79 | + it "should parse #{state}" do |
| 80 | + |
| 81 | + stub_request(:head, "https://app.codeship.com/projects/#{state}/status?branch=master"). |
| 82 | + with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}). |
| 83 | + to_return(status: 200, body: "", headers: {'Content-Disposition' => "inline; filename=\"status_#{state}.svg\""}) |
| 84 | + |
| 85 | + project_status = Codeship::Status.new(state, branch: 'master') |
| 86 | + expect(project_status.status).to eq(state) |
| 87 | + end |
| 88 | + end |
| 89 | + end |
60 | 90 | end |
61 | 91 | end |
0 commit comments