Sha256: 236126a5965b2931428760adef7e8298616a25b226995352d8bc7096a68b161b

Contents?: true

Size: 990 Bytes

Versions: 3

Compression:

Stored size: 990 Bytes

Contents

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

require 'spec/helper'

class SpecHelperFlash < Ramaze::Controller
  map :/
  helper :flash
  trait :flashbox => "%key : %value"

  def box
    flashbox
  end

  def populate_one
    flash[:one] = 'for starters'
  end

  def populate_two
    flash[:one] = 'this one'
    flash[:two] = 'and this'
  end
end

describe Ramaze::Helper::Flash do
  behaves_like :session

  it 'displays a flashbox with one item' do
    session do |mock|
      mock.get('/populate_one')
      got = mock.get('/box')
      got.status.should == 200
      got.body.should == 'one : for starters'
    end
  end

  it 'displays a flashbox with two items' do
    session do |mock|
      mock.get('/populate_two')
      got = mock.get('/box')
      got.status.should == 200
      got.body.split("\n").sort.should == ['one : this one', 'two : and this']
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
Pistos-ramaze-2009.04.08 spec/ramaze/helper/flash.rb
manveru-ramaze-2009.04.01 spec/ramaze/helper/flash.rb
manveru-ramaze-2009.04.08 spec/ramaze/helper/flash.rb