summaryrefslogtreecommitdiff
path: root/test/functional/static_config_controller_test.rb
blob: 7027bf81ed9a53706404030f73b324e2396374dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'test_helper'

# use minitest for stubbing, rather than bloated mocha
require 'minitest/mock'

class StaticConfigControllerTest < ActionController::TestCase

  def setup
  end

  def test_provider_success
    @controller.stub(: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
    @controller.stub(: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