summaryrefslogtreecommitdiff
path: root/features/step_definitions
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-07-28 11:05:46 +0200
committerAzul <azul@leap.se>2014-07-31 10:03:38 +0200
commit1092bbc337edc5973fad63bea559ecc2a3a5b896 (patch)
tree7571646015a24623e439c4af3f067fe469f9c406 /features/step_definitions
parent297b42cd7557a7508cdbf091163da48bbd52a79a (diff)
features for anonymous use and service endpoint
Also moved the location of the config files into a configuration setting.
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