From f619178085d0c2729e275fa4f46f9cd981189d3e Mon Sep 17 00:00:00 2001 From: elijah Date: Sun, 29 Dec 2013 19:25:05 -0800 Subject: Return 'provider.json' via a controller, to better be able to control the response headers (in particular, 'X-Minimum-Client-Version'). It must now be placed in config/provider/provider.json --- test/functional/static_config_controller_test.rb | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/functional/static_config_controller_test.rb (limited to 'test/functional/static_config_controller_test.rb') diff --git a/test/functional/static_config_controller_test.rb b/test/functional/static_config_controller_test.rb new file mode 100644 index 0000000..9c2cfef --- /dev/null +++ b/test/functional/static_config_controller_test.rb @@ -0,0 +1,27 @@ +require 'test_helper' + +# use minitest for stubbing, rather than bloated mocha +require 'minitest/stub_const' + +class StaticConfigControllerTest < ActionController::TestCase + + def setup + end + + def test_provider_success + StaticConfigController.stub_const(:PROVIDER_JSON, file_path('provider.json')) do + get :provider, format: :json + assert_equal 'application/json', @response.content_type + assert_response :success + end + end + + def test_provider_not_modified + StaticConfigController.stub_const(:PROVIDER_JSON, file_path('provider.json')) do + request.env["HTTP_IF_MODIFIED_SINCE"] = File.mtime(file_path('provider.json')).rfc2822() + get :provider, format: :json + assert_response 304 + end + end + +end -- cgit v1.2.3