Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Conway committed May 14, 2015
1 parent 78df5a5 commit 63d116c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
20 changes: 18 additions & 2 deletions spec/heroku/command/addons_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,16 @@ module Heroku::Command
{ body: MultiJson.encode(addon), status: 201 }
end

expect(@addons.api).to receive(:request) { |args|
expect(args[:path]).to eq "/apps/example/addons"
expect(args[:method]).to eq :post
}.and_return(OpenStruct.new(body: stringify(addon)))

expect(@addons.api).to receive(:request) { |args|
expect(args[:path]).to eq "/addon-services/example-addon/plans/premium"
expect(args[:method]).to eq :get
}.and_return(OpenStruct.new(body: { 'plan' => { 'cents' => '10000' } }))

stderr, stdout = execute("addons:add my_addon foo=baz --baz=bar bob=true --bar")
expect(stderr).to eq("")
expect(stdout).to include("Warning: non-unix style params have been deprecated, use --foo=baz --bob=true instead")
Expand Down Expand Up @@ -487,11 +497,17 @@ module Heroku::Command
allow(@addons).to receive(:args).and_return(%w(my_addon))

expect(@addons.api).to receive(:request) { |args|
expect(args[:method]).to eq :patch
expect(args[:path]).to eq "/apps/example/addons/my_addon"
}
expect(args[:method]).to eq :patch
}.and_return(OpenStruct.new(body: { 'plan' => { 'name' => 'example-addon:premium' } }))

expect(@addons.api).to receive(:request) { |args|
expect(args[:path]).to eq "/addon-services/example-addon/plans/premium"
expect(args[:method]).to eq :get
}.and_return(OpenStruct.new(body: { 'plan' => { 'cents' => '10000' } }))

@addons.upgrade
Excon.stubs.shift
end

# TODO: need this?
Expand Down
1 change: 1 addition & 0 deletions spec/support/addons_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def build_addon(addon={})

plan: {
id: SecureRandom.uuid,
name: "example-addon:premium"
}.merge(addon.fetch(:plan, {})),

app: {
Expand Down

0 comments on commit 63d116c

Please sign in to comment.