Sha256: 38ec51498bfde48bd054cfcec7f5a5503e718a4561771e1b172932f7627d58a2

Contents?: true

Size: 798 Bytes

Versions: 9

Compression:

Stored size: 798 Bytes

Contents

$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')

require 'test/unit'
require 'ostruct'

require 'nitro'
require 'nitro/controller'
require 'nitro/flash'

class TC_Flash < Test::Unit::TestCase # :nodoc: all
  include Nitro

  class MyController < Controller
    attr_accessor :flag
    
    def action1
      flash[:msg] = 'Hello world!'
    end
    
    def action2
      @flag = flash[:msg]
    end
  end

  def setup
    @conf = OpenStruct.new
  end

  def teardown
    @conf = nil
  end
  
  def test_all
    ctx = Context.new(@conf)
    ctx.headers = {}
    ctx.params = {}
    ctx.instance_eval '@session = {}'
    c = MyController.new(ctx)  
    c.action1
    c.action2
    assert_equal 'Hello world!', c.flag
    c.action2
    assert_equal 'Hello world!', c.flag
  end  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
nitro-0.21.0 test/nitro/tc_flash.rb
nitro-0.21.2 test/nitro/tc_flash.rb
nitro-0.22.0 test/nitro/tc_flash.rb
nitro-0.23.0 test/nitro/tc_flash.rb
nitro-0.24.0 test/nitro/tc_flash.rb
nitro-0.25.0 test/nitro/tc_flash.rb
nitro-0.26.0 test/nitro/tc_flash.rb
nitro-0.27.0 test/nitro/tc_flash.rb
nitro-0.28.0 test/nitro/tc_flash.rb