Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for inspection of environment and config_path. #4

Merged
merged 1 commit into from
Oct 18, 2013

Conversation

damncabbage
Copy link
Contributor

As part of some tests I have, I need to be able to temporarily swap out the environment and config_path, eg.

def modify_app_constants(&block)
  old_config_path = AppConstants.config_path
  old_environment = AppConstants.environment
  yield if block_given?
  AppConstants.config_path = old_config_path
  AppConstants.environment = old_environment
  AppConstants.load!
end

There's no way to do this at present; this pull requests adds a couple of attribute readers (with tests) for this purpose.

@damncabbage
Copy link
Contributor Author

It's up to you as to whether or not you want to accept this, but we're switching our tests to stubbing methods on the AppConstants class directly when our tests need to test code that calls it directly. In case it's useful to anyone:

before { AppConstants.stub(:gitBinary, "/usr/local/bin/gitwrapper.sh") }
it "uses the gitBinary setting when constructing commands" do
  Shell.should_receive(:run).with('/usr/local/bin/gitwrapper.sh clone /foo/bar/.git /baz/destination')
  Git.clone('/foo/bar', '/baz/destination')
end

@theleoborges
Copy link
Owner

Hey @damncabbage ,

Sorry about the delay but I've been flat out in the past couple of weeks. I'll have a closer look at your PR this week and let you know about it.

Thanks!

@theleoborges theleoborges merged commit 3d7ccdf into theleoborges:master Oct 18, 2013
@theleoborges
Copy link
Owner

Well there's no excuse I left you hanging on this :(

Anyway, I just merged your PR and will make a new release, 1.0.5, so you can update. I received another PR recently so another update might be coming as well.

Thank you for taking the time to submit a PR.

@theleoborges
Copy link
Owner

Done. New release is up: 1.0.5

@damncabbage damncabbage deleted the config_inspection branch October 18, 2013 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants