Sha256: a9e3285f743f8c47750ee4d6de94c7fb5e0fd70878a454fb823803abbeb0f12d

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'

class CampfireTest < Test::Unit::TestCase
  
  def setup
    @campfire = Tinder::Campfire.new("foobar")
    @response = mock("response")
  end
  
  def test_verify_response_redirect_true
    @response.expects(:code).returns(302)
    assert true === @campfire.send(:verify_response, @response, :redirect)
  end
  
  def test_verify_response_redirect_false
    @response.expects(:code).returns(200)
    assert false === @campfire.send(:verify_response, @response, :redirect)
  end
    
  def test_verify_response_success
    @response.expects(:code).returns(200)
    assert true === @campfire.send(:verify_response, @response, :success)
  end

  def test_verify_response_redirect_to
    @response.expects(:code).returns(304)
    @response.expects(:[]).with('location').returns("/foobar")
    assert true === @campfire.send(:verify_response, @response, :redirect_to => '/foobar')
  end
  
  def test_verify_response_redirect_to_without_redirect
    @response.expects(:code).returns(200)
    assert false === @campfire.send(:verify_response, @response, :redirect_to => '/foobar')
  end
  
  def test_verify_response_redirect_to_wrong_path
    @response.expects(:code).returns(302)
    @response.expects(:[]).with('location').returns("/baz")
    assert false === @campfire.send(:verify_response, @response, :redirect_to => '/foobar')
  end
  
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tinder-0.1.1 test/unit/campfire_test.rb
tinder-0.1.2 test/unit/campfire_test.rb