Sha256: 059f85f7794e847aa43db41be9f016b856948f777f0b551cad95379db98d5293

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

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

class SimpleObject 
  include Lolita::Builder
end

describe Lolita::Builder do

  let(:object){SimpleObject.new}

  describe "#build" do
    it "should return default component information when no params passed" do
      info=object.build
      info.first.should == :"/simple_object"
      info[1].should == :display
      info.last.should have_key(:simple_object)
    end

    context "with instance builder" do
      it "should use given one" do
        object.builder="custom"
        info=object.build
        info.first.should==:"/simple_object/custom"
        info[1].should == :display
      end

      it "should use that what #build receive" do
        object.builder="custom"
        info=object.build("other")
        info.first.should == :"/simple_object/other"
        info[1].should == :display
      end
    end

    it "should accept empty name" do
      info=object.build("",:list)
      info.first.should == :"/simple_object"
      info[1].should == :list
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lolita-3.1.6 spec/builder_spec.rb
lolita-3.1.5 spec/builder_spec.rb
lolita-3.1.4 spec/builder_spec.rb
lolita-3.1.3 spec/builder_spec.rb
lolita-3.1.2 spec/builder_spec.rb
lolita-3.1.1 spec/builder_spec.rb
lolita-3.1.0 spec/builder_spec.rb