Sha256: dcdc98ce5a91f73042da15864102a46ba71dd7f431f2f0f099dee4cb33221e90

Contents?: true

Size: 976 Bytes

Versions: 1

Compression:

Stored size: 976 Bytes

Contents

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

describe Rtml::Widgets do
  it "should find Widgets affecting a target" do
    Rtml::Widgets.affecting("document").should_not be_empty
  end

  context "included into a class" do
    context "with no widgets" do
      subject { k = Class.new; k.send(:include, Rtml::Widgets); k.new }
      it "should be able to iterate through widgets, even if there aren't any" do
        subject.widgets.each { }
      end
    end

    context "with widgets" do
      subject do
        k = Class.new
        def k.name; "MyTest"; end
        k.send(:include, Rtml::Widgets)

        class MyWidget < Rtml::Widget
          affects "MyTest"
          entry_point :test_method
          def test_method; 1; end
        end

        ### Rtml::Widgets.add_proxies_to_base(k)
        k.new
      end

      it "should respond to entry points" do
        subject.test_method.should == 1
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtml-2.0.4 spec/lib/rtml/widgets_spec.rb