Sha256: 09a813a2ace3d14b01ce94eeee35d4a406beb9eab7d9617e4991aed3488b2735

Contents?: true

Size: 674 Bytes

Versions: 4

Compression:

Stored size: 674 Bytes

Contents

describe DslBuilder do

  # TODO: break this out a bit...
  it 'should allow using DSL-style accessors' do
    class MyBuilder < DslBuilder
      dsl_accessor :name
      dsl_flag :flagged
    end
    builder = MyBuilder.new

    # Test standalone
    builder.name 'ProjectX'
    builder.name.should == 'ProjectX'
    
    builder.flagged?.should be_false
    builder.flagged = true
    builder.flagged?.should be_true
    builder.flagged = false
    
    # Test as part of DslProxy usage (common case)
    DslProxy.exec(builder) do
      name 'Project Omega'
      flagged!
    end
    builder.name.should == 'Project Omega'
    builder.flagged?.should be_true
  end
  
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
iron-dsl-1.0.0 spec/dsl/dsl_builder_spec.rb
iron-extensions-1.1.5 spec/extensions/dsl_builder_spec.rb
iron-extensions-1.1.4 spec/extensions/dsl_builder_spec.rb
iron-extensions-1.1.3 spec/extensions/dsl_builder_spec.rb