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