summaryrefslogtreecommitdiff
path: root/features/step_definitions/config_steps.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-11-11 13:06:42 -0800
committerelijah <elijah@riseup.net>2014-11-11 13:06:42 -0800
commitc3305f1c29a1a37913bfb05cd11d547e9d7f16a0 (patch)
treecbe7844b1cf7c3b0370080af27f76702564e1c18 /features/step_definitions/config_steps.rb
parentc8b9e7ac72d27997603dbede8001fca7d3f40e1a (diff)
parentcbf73046f42aeafb760e378d872f8c06f8bdfe86 (diff)
Merge branch 'test/feature-for-service-endpoint' of https://github.com/azul/leap_web into develop
Diffstat (limited to 'features/step_definitions/config_steps.rb')
-rw-r--r--features/step_definitions/config_steps.rb22
1 files changed, 17 insertions, 5 deletions
diff --git a/features/step_definitions/config_steps.rb b/features/step_definitions/config_steps.rb
index 70ff1aa..1fc67f5 100644
--- a/features/step_definitions/config_steps.rb
+++ b/features/step_definitions/config_steps.rb
@@ -1,12 +1,20 @@
-Given /the provider config is:$/ do |config|
- @tempfile = Tempfile.new('provider.json')
- @tempfile.write config
+# use with @tempfile, @config
+Given /there is a config for the (.*)$/ do |config|
+ @dummy_config = {dummy_config_for: config}.to_json
+ @tempfile = Tempfile.new("#{config}.json")
+ @tempfile.write @dummy_config
@tempfile.close
- StaticConfigController::PROVIDER_JSON = @tempfile.path
+ if config == 'provider'
+ StaticConfigController::PROVIDER_JSON = @tempfile.path
+ else
+ @orig_config ||= APP_CONFIG.dup
+ APP_CONFIG[:config_file_paths].merge! "#{config}-service" => @tempfile.path
+ end
end
-# use with @config tag so the config changes are reverted after the scenario
+# use with @config
Given /^"([^"]*)" is (enabled|disabled|"[^"]") in the config$/ do |key, value|
+ @orig_config ||= APP_CONFIG.dup
value = case value
when 'disabled' then false
when 'enabled' then true
@@ -14,3 +22,7 @@ Given /^"([^"]*)" is (enabled|disabled|"[^"]") in the config$/ do |key, value|
end
APP_CONFIG.merge! key => value
end
+
+Then /^the response should be that config$/ do
+ assert_equal @dummy_config, last_response.body
+end