Sha256: 747d69e45d8b2003d15fe7d9fe38c859d5154dea74b9edcce06037125b9a8ea2

Contents?: true

Size: 1.78 KB

Versions: 4

Compression:

Stored size: 1.78 KB

Contents

require File.join(__FILE__.gsub(/(.*)?\/spec\/.*$/, '\1'), 'spec/spec_helper')
require File.join(__FILE__.gsub(/(.*)?\/spec\/.*$/, '\1'), 'spec/support/lib/rtml/widgets/test_widget1')
require File.join(__FILE__.gsub(/(.*)?\/spec\/.*$/, '\1'), 'spec/support/lib/rtml/widgets/test_widget2')

describe Rtml::Widget do
  before(:each) do
    @doc = Rtml::Document.new
    @doc.setup_default_document
    @scr = @doc.screen :idle
  end

  it "should have default values for shared variables before entry points are called"

  it "should include list of widgets" do
    @scr.widgets.should include(Rtml::Widgets::Frontend)
  end

  it "should include list of entry points" do
    @scr.widget_entry_points.should include('display')
  end

  it "should not lose value for shared variables between entry points" do
    @doc.hash_entry_1
    @doc.hash_entry_2

    @doc.hash_with_value.should == {:value => 1}
  end

  it "should allow use of shared variables" do
    #@tml_docs.test1
  end

  it "should not share targets" do
    TestWidget1.targets.should_not == TestWidget2.targets
  end

  it "should not share entry points" do
    TestWidget1.entry_points.should_not == TestWidget2.entry_points
  end

  it "document should respond_to entry points for TestWidget1 but not TestWidget2" do
    @doc.should_not be_nil

    TestWidget1.entry_points.each do |entry_point|
      @doc.should respond_to(entry_point)
    end
    TestWidget2.entry_points.each do |entry_point|
      @doc.should_not respond_to(entry_point)
    end
  end

  it "should not hang if entry point does not exist" do
    # If the test succeeds, the method will be missing. However, if it fails, it'll just hang the app,
    # so dev needs to figure out why the hard way.
    lambda { @doc.missing_widget_entry_point }.should raise_error(NoMethodError)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtml-2.0.3 spec/lib/rtml/widget_spec.rb
rtml-2.0.2 spec/lib/rtml/widget_spec.rb
rtml-2.0.1 spec/lib/rtml/widget_spec.rb
rtml-2.0.0.alpha.1 spec/lib/rtml/widget_spec.rb