Sha256: 4bc5697acce7f5c82faf09a8a19f3df8fe2c87bcee3da862567b06c28940eb9c

Contents?: true

Size: 728 Bytes

Versions: 3

Compression:

Stored size: 728 Bytes

Contents

require 'test_helper'

class SampleControllerTest < ActionController::TestCase

  def setup
    @document = Disclaimer::Document.first
  end

  def test_index_default_redirect
    get :index
    assert_redirected_to("/disclaimer/documents/#{@document.name}")
    assert_equal({@document.name.to_sym => "http://#{request.host}/sample"}, session[:disclaimer])
  end

  def test_index_with_disclaimer_accepted
    get(
      :index,
      {},
      :disclaimer => {@document.name.to_sym => :accepted}
    )
    assert_response :success
  end

  def test_bypass_disclaimer
    get :bypass_disclaimer
    assert_response :success
    assert_nil session[:disclaimer], "Session should not be set when disclaimer is bypassed"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
disclaimer-0.0.3 test/dummy/test/functional/sample_controller_test.rb
disclaimer-0.0.2 test/dummy/test/functional/sample_controller_test.rb
disclaimer-0.0.1 test/dummy/test/functional/sample_controller_test.rb