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

Adding environments #10

Merged
merged 5 commits into from
Apr 25, 2015
Merged

Adding environments #10

merged 5 commits into from
Apr 25, 2015

Conversation

slpsys
Copy link
Contributor

@slpsys slpsys commented Apr 24, 2015

This works like in the Jira ticket:

# initializer
Pester.configure do |c| 
  c.environment[:aws] = { 'whatever' => 'ok' }
end

sets up an Environment object with some config options, and:

# app
class Thing 
  Pester.aws.retry do 
    something_faily
  end
end

Pester.aws returns the :aws Environment object, which acts as a proxy back to Pester#retry_whatever, injecting the environment options along the way. Kinda wonky in implementation I guess, but I like the abstraction it provides.

@apurvis @dollschasingmen

@slpsys
Copy link
Contributor Author

slpsys commented Apr 24, 2015

Still needs tests.

@apurvis
Copy link

apurvis commented Apr 24, 2015

so if i have this right, the environment variable is basically just a hash of config options for pester that you want to execute when you call Pester.that_environment.something?

@slpsys
Copy link
Contributor Author

slpsys commented Apr 24, 2015

you don't really execute the config options per se, it it's more that you're defining a named set of parameters, and injecting them by name when calling any of the retry_ methods, calling Pester.named_params.retry { } instead of Pester.retry(NAMED_PARAMS) {}

it really just cleans up the application code by

  1. GETTING_RID_OF_SCREAMING_SNAKE_CASE_FOR_ALL_THE_CONSTANTS
  2. putting all the config in the initializer, instead of all over your codebase

it also does it without creating instances (and making you store instances all over your app). i don't really care that much about that in this case, but this seems nice

@apurvis
Copy link

apurvis commented Apr 24, 2015

works for me (if specs)

@slpsys slpsys changed the title WIP: Adding basic scaffold for environments Adding basic scaffold for environments Apr 25, 2015
@slpsys slpsys changed the title Adding basic scaffold for environments Adding environments Apr 25, 2015
slpsys added a commit that referenced this pull request Apr 25, 2015
@slpsys slpsys merged commit ab28101 into master Apr 25, 2015
@slpsys slpsys deleted the environments branch April 25, 2015 20:30
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.

2 participants