Sha256: 6f145fcbe3d6b8660be197a0814e7ec631ec21050ecf7c27dd68332dbd8ebed0
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 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%20message'} end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
apiaryio-0.4.2 | spec/apiary/command/publish_spec.rb |
apiaryio-0.4.1 | spec/apiary/command/publish_spec.rb |
apiaryio-0.4.0-x86_64-darwin-13 | spec/apiary/command/publish_spec.rb |