Sha256: 5914df4ef540189f5e205fbc5dc08825db26867513ed15b805dca4961395c749

Contents?: true

Size: 952 Bytes

Versions: 11

Compression:

Stored size: 952 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "OAttr" do
  it "should define a module" do
    OAttr.should_not == nil
  end

  #it "should define a oattr class method" do
  #  OAttr.oattr.should_not == nil
  #end

  describe "with an included OAttr module" do
    before :each do
      class Foo; include OAttr; end
    end
    it "should include the oattr class method" do
      Foo.oattr.should_not == nil
    end
    it "should define a bar method" do
      class Foo; 
        oattr :bar
        def initialize; @options = { :bar => 123}; end; 
      end
      (Foo.new.respond_to? :bar).should == true
      Foo.new.bar.should == 123
    end

    it "should handle container options" do
      class Foo; 
        oattr :xxx, :foo, :container => :params
        def initialize; @params = { :xxx => 321}; end; 
      end
      (Foo.new.respond_to? :xxx).should == true
      Foo.new.xxx.should == 321
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
applix-0.4.4 spec/oattr_spec.rb
applix-0.4.3 spec/oattr_spec.rb
applix-0.4.2 spec/oattr_spec.rb
applix-0.3.8 spec/oattr_spec.rb
applix-0.3.7 spec/oattr_spec.rb
applix-0.3.6 spec/oattr_spec.rb
applix-0.3.5 spec/oattr_spec.rb
applix-0.3.4 spec/oattr_spec.rb
applix-0.3.0 spec/oattr_spec.rb
applix-0.2.2 spec/oattr_spec.rb
applix-0.2.1 spec/oattr_spec.rb