From 1092bbc337edc5973fad63bea559ecc2a3a5b896 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 28 Jul 2014 11:05:46 +0200 Subject: features for anonymous use and service endpoint Also moved the location of the config files into a configuration setting. --- features/step_definitions/config_steps.rb | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'features/step_definitions/config_steps.rb') 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 -- cgit v1.2.3