Sha256: 8097b7726f7d5e11ce2f313aa959adbc97d1e72f71b3440cff342e925036010c

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'test_helper'
class CookieControllerTest < ActionController::TestCase
  
  test "should render index" do
    get :index
    
    assert_response :success
    assert_template :index
  end
  
  test "should have the correct cookies" do
    get :index 
    
    assert_equal 'this is a test', cookies['test_one']
    assert_equal 'test_value', cookies['test_two']
  end
  
  test "should have the correct instance variables" do
    get :index
    
    assert_equal 'this is a test', assigns(:test_one)
    assert_equal 'test_value', assigns(:test_two)
  end
  
  test "should update the instance variables when given new values via params" do
    get :index, :test_one => 'new_value', :test_two => 'second_new_value'
    
    assert_equal 'new_value', assigns(:test_one)
    assert_equal 'second_new_value', assigns(:test_two)
  end
  
  test "should update the cookies when given new values via params" do
    get :index, :test_one => 'new_value', :test_two => 'second_new_value'
    
    assert_equal 'new_value', cookies['test_one']
    assert_equal 'second_new_value', cookies['test_two']
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cookie_tracker-1.0.0 test/cookie_controller_test.rb