Sha256: dfcc68a59da0d97dc7e2870ecfa7ccfc64a7014168ddabee4c952340bcca49e7

Contents?: true

Size: 1.41 KB

Versions: 5

Compression:

Stored size: 1.41 KB

Contents

#          Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require 'spec/helper'

class TCRedirectHelperController < Ramaze::Controller
  map :/
  helper :redirect

  def index
    self.class.name
  end

  def noop
    'noop'
  end

  def redirection
    redirect :index
  end

  def double_redirection
    redirect :redirection
  end

  def redirect_referer_action
    redirect_referer
  end

  def no_actual_redirect
    catch(:redirect){ redirection }
    'foo'
  end

  def no_actual_double_redirect
    catch(:redirect){ double_redirection }
    'bar'
  end
end

describe "RedirectHelper" do
  ramaze(:adapter => :webrick)

  b = Browser.new

  it "testrun" do
    b.get('/').should == "TCRedirectHelperController"
  end

  it "calls" do
    b.story do
      get('/redirection').should        == "TCRedirectHelperController"
      get('/double_redirection').should == "TCRedirectHelperController"
      get('/no_actual_redirect').should        == 'foo'
      get('/no_actual_double_redirect').should == 'bar'
    end
  end

  it "redirect to referer" do
    b.story do
      get('/').should                        == 'TCRedirectHelperController'
      get('/redirect_referer_action').should == 'TCRedirectHelperController'
      get('/noop').should                    == 'noop'
      get('/redirect_referer_action').should == 'noop'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ramaze-0.1.2 spec/ramaze/helper/redirect.rb
ramaze-0.1.3 spec/ramaze/helper/redirect.rb
ramaze-0.1.1 spec/ramaze/helper/redirect.rb
ramaze-0.1.0 spec/ramaze/helper/redirect.rb
ramaze-0.1.4 spec/ramaze/helper/redirect.rb