Sha256: abff3e2c9027f796630fc9faaee1f5f482ea14f89184dd624f8aececc738b9b6

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

require File.join(__FILE__.gsub(/(.*)?\/spec\/.*$/, '\1'), 'spec/spec_helper')

describe Rtml::Widgets::StaticContent do
  before :each do
    @doc = Rtml::Document.new(:name => 'magcard', :view_path => File.join(Rtml.root, "spec/support/app/views"))
    @scr = @doc.screen :main
  end

  it "should accept a string instead of options or block" do
    assert_nothing_raised do
      sc = @scr.static_content("hello")
      assert_equal "hello", sc.to_tml
    end
  end

  it "should accept a partial hash" do
    assert_nothing_raised do
      sc = @scr.static_content(:partial => 'partial')
      assert_equal 'this is a partial', sc.to_tml
    end
  end

  it "should accept a file hash" do
    assert_nothing_raised do
      sc = @scr.static_content(:file => 'main')
      assert_equal 'Hello, World!', sc.to_tml
    end
  end

  it "should accept no arguments" do
    assert_nothing_raised do
      sc = @scr.static_content
      assert_equal 'Hello, World!', sc.to_tml
    end
  end

  it "should accept a block with no other arguments" do
    assert_nothing_raised do
      sc = @scr.static_content { "Hello, World" }
      assert_equal "Hello, World", sc.to_tml
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rtml-2.0.4 spec/widgets/static_content_spec.rb
rtml-2.0.3 spec/widgets/static_content_spec.rb
rtml-2.0.2 spec/widgets/static_content_spec.rb
rtml-2.0.1 spec/widgets/static_content_spec.rb
rtml-2.0.0.alpha.1 spec/widgets/static_content_spec.rb