Sha256: 4b5d02789fbf392030a2937a197845431390def9489b38307cdd264093eba961

Contents?: true

Size: 973 Bytes

Versions: 4

Compression:

Stored size: 973 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'
require File.join(File.dirname(__FILE__), "..", "lib", "merb-flash")

Merb::BootLoader::BeforeAppLoads.run

class FlashTestController < Merb::Controller
  def standard
    redirect "/", :message => {:notice => "Chunky bacon!"}
  end
  
  def shortcut
    redirect "/", :message => "Chunky bacon?"
  end
end

describe "merb-flash" do
  it "shouldn`t have message in url" do
    @controller = dispatch_to(FlashTestController, :standard)
    @controller.headers["Location"].should == "/"
  end
  
  it "should have message in session" do
    @controller = dispatch_to(FlashTestController, :standard)
    @controller.session.should == Mash.new(:flash => {:notice => "Chunky bacon!"})
  end
  
  it "should use shortcut :message => 'foo' as :message => {:notice => 'foo'}" do
    @controller = dispatch_to(FlashTestController, :shortcut)
    @controller.session.should == Mash.new(:flash => {:notice => "Chunky bacon?"})
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
teamon-merb-flash-0.1.3 spec/merb-flash_spec.rb
teamon-merb-flash-0.1.4 spec/merb-flash_spec.rb
merb-flash-0.1.5 spec/merb-flash_spec.rb
merb-flash-0.1.4 spec/merb-flash_spec.rb