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. # Update: Now I'm getting stack level errors, instead of hanging systems, when it fails. Progress. lambda { @doc.missing_widget_entry_point }.should raise_error(NoMethodError) end end