Skip to content

Commit

Permalink
Merge pull request #7 from envato/fix-tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
beegibson committed Jan 18, 2016
2 parents 6e916aa + cba47a2 commit 45eba21
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/akamai_rspec/matchers/honour_origin_headers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
end

def fix_date_header(origin_response)
origin_response.headers[:date] = Time.now.httpdate unless origin_response.headers[:date]
origin_response.headers[:date] ||= Time.now.httpdate
origin_response
end

Expand Down
2 changes: 1 addition & 1 deletion spec/functional/matchers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
describe 'be_forwarded_to_index' do
it 'should have tests' do
pending
Fail
fail
end
end
8 changes: 5 additions & 3 deletions spec/unit/matchers/honour_origin_cache_headers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@

describe 'honour_origin_cache_headers' do
context 'fix_date_header' do
let(:date) { Time.now }
let(:headers) { {} }
it 'should leave filled in date unchanged' do
origin_response = double(RestClient::Response)
allow(origin_response).to receive(:headers) { { :date => 'something' } }
expect(fix_date_header(origin_response)).to equal(origin_response)
end

it 'should fill in date if it is absent' do
pending
allow(Time).to receive(:now).and_return(date)
origin_response = double(RestClient::Response)
allow(origin_response).to receive(:headers) { { } }
expect(fix_date_header(origin_response).headers[:date]).to eq(Time.now.httpdate)
allow(origin_response).to receive(:headers).and_return(headers)
expect(fix_date_header(origin_response).headers[:date]).to eq(date.httpdate)
end

end
Expand Down

0 comments on commit 45eba21

Please sign in to comment.