Sha256: 4d40c95b918753fe77dfd58bdd58c6cb063127c27108d4ec0712f21553c5f689

Contents?: true

Size: 964 Bytes

Versions: 5

Compression:

Stored size: 964 Bytes

Contents

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

require File.expand_path('../../../../spec/helper', __FILE__)

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 :rack_test

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ramaze-2023.01.06 spec/ramaze/helper/flash.rb
ramaze-2012.12.08 spec/ramaze/helper/flash.rb
ramaze-2012.12.08b spec/ramaze/helper/flash.rb
ramaze-2012.04.14 spec/ramaze/helper/flash.rb
ramaze-2012.03.07 spec/ramaze/helper/flash.rb