Sha256: caf4e57b1d60edfbf8d9b7bd55dd362ef21463dbb8834deed6ca24213af86708
Contents?: true
Size: 1.58 KB
Versions: 13
Compression:
Stored size: 1.58 KB
Contents
require 'spec_helper' describe Apiary::Command::Publish do context 'when constructed without a message' do let(:message) do Apiary::Command::Publish.new(api_name: 'myapi', path: 'spec/fixtures/apiary.apib', api_key: 'testkey').options.message end it 'uses the default message' do expect(message).to eq('Saving API Description Document from apiary-client') end end context 'when constructed with a message' do let(:message) do Apiary::Command::Publish.new(api_name: 'myapi', message: 'Custom message', path: 'spec/fixtures/apiary.apib', api_key: 'testkey').options.message end it 'stores the message in the opts' do expect(message).to eq('Custom message') end end describe '#execute' do context 'when calling with a custom message' do before(:all) do WebMock.stub_request(:post, 'https://api.apiary.io/blueprint/publish/myapi') Apiary::Command::Publish.new(api_name: 'myapi', message: 'Custom message', path: 'spec/fixtures/apiary.apib', api_key: 'testkey').execute end it 'sends the message when publishing' do expect(WebMock).to have_requested(:post, 'https://api.apiary.io/blueprint/publish/myapi') .with { |request| request.body.include? 'messageToSave=Custom+message' } end end end end
Version data entries
13 entries across 13 versions & 1 rubygems