summaryrefslogtreecommitdiff
path: root/features/step_definitions
diff options
context:
space:
mode:
Diffstat (limited to 'features/step_definitions')
-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