Sha256: 9fb328fe3fa77a44a3fd4428fb7e8c7395b59641a557bd386178751b1b32ef55

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

require 'test_helper'

class RjsHelperTest < ActiveSupport::TestCase
  include EaselHelpers::Helpers::RjsHelper
  include EaselHelpers::Helpers::MessageHelper

  context "inline_flash" do
    setup do
      @page = Object.new
      @flash_hash = {:notice => "Test!"}
      self.expects(:messages).with({:notice => "Test!"}).returns("string")
    end

    context "without keeping flash" do
      setup do
        @flash_hash.expects(:discard).returns(true)
      end

      should "default to inserting flash within div#flash-container" do
        @page.expects(:insert_html).with(:top, "flash-container", "string")
        inline_flash(@page, @flash_hash)
      end

      should "allow assignment of container id" do
        @page.expects(:insert_html).with(:top, "my-custom-id", "string")
        inline_flash(@page, @flash_hash, {:container => "my-custom-id"})
      end

      should "allow replacement of current flash container's HTML" do
        @page.expects(:replace_html).with("flash-container", "string")
        inline_flash(@page, @flash_hash, {:replace => true})
      end
    end

    context "when keeping flash" do
      setup do
        @flash_hash.expects(:discard).never
      end

      should "default to inserting flash within div#flash-container" do
        @page.expects(:insert_html).with(:top, "flash-container", "string")
        inline_flash(@page, @flash_hash, :keep_flash => true)
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
fusionary-easel_helpers-0.2.17 test/rjs_helper_test.rb
fusionary-easel_helpers-0.3.0 test/rjs_helper_test.rb
easel_helpers-0.3.0 test/rjs_helper_test.rb