Skip to content

Deep clone STACKS constant #9

Merged
merged 2 commits into from Apr 6, 2012

2 participants

@kmayer
kmayer commented Apr 6, 2012

I found a bug where setting the stack on an app was persisting across tests.

i.e. in a test, create an app with a non-default stack.
in the next test create an app with out specifying a stack, when you look at STACKS, it has been modified.

STACKS.dup does a shallow copy, I replaced it with a deep one.

@kmayer kmayer commented on the diff Apr 6, 2012
lib/heroku/api/mock/stacks.rb
@@ -34,7 +34,7 @@ module Mock
request_params, mock_data = parse_stub_params(params)
app, _ = request_params[:captures][:path]
with_mock_app(mock_data, app) do |app_data|
- stack_data = STACKS.dup
+ stack_data = Marshal::load(Marshal.dump(STACKS))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@geemus geemus merged commit 1c3ebbb into heroku:master Apr 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.