Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions spec/lib/travis/remote_log_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,35 @@

expect(subject.clear!(user)).to eq(content)
end

context 'when the log is not archived' do
let(:local_content) { 'Content from DB' }

before do
subject.archived_at = nil
subject.archive_verified = false
subject.content = local_content
end

it 'does not fetch archived content' do
expect(subject).not_to receive(:archived_log_content)
from_json = JSON.parse(subject.to_json).fetch('log')
expect(from_json.fetch('body')).to eq(local_content)
end
end

context 'when the log is archived' do
before do
subject.archived_at = Time.now
subject.archive_verified = true
end

it 'fetches archived content' do
expect(subject).to receive(:archived_log_content).and_return(archived_content)
from_json = JSON.parse(subject.to_json).fetch('log')
expect(from_json.fetch('body')).to eq(archived_content)
end
end
end

describe Travis::RemoteLog::Client do
Expand Down