Sha256: fc2f1aac9f9e9412ec2ea6d894918b77152c524d79324279be4b007d4121862a

Contents?: true

Size: 829 Bytes

Versions: 11

Compression:

Stored size: 829 Bytes

Contents

require 'spec_helper'

module Blazing

  describe DSLSetter do

    let(:dummy) { class Dummy; extend DSLSetter; end }
    let(:dummy_instance) { Dummy.new }

    it 'it defines a dsl method named after each argument provided' do
      dummy.dsl_setter(:foo, :bar)
      dummy_instance.should respond_to :foo
      dummy_instance.should respond_to :bar
    end

    context 'the generated dsl method' do
      it 'sets an instance variable when provided with an argumnent' do
        dummy_instance.foo('something')
        dummy_instance.instance_variable_get(:@foo).should == 'something'
      end

      it 'returns the value of the istance variable when no argument is provided' do
        dummy_instance.instance_variable_set(:@foo, 'something')
        dummy_instance.foo.should == 'something'
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
blazing-0.4.2 spec/blazing/dsl_setter_spec.rb
blazing-0.4.1 spec/blazing/dsl_setter_spec.rb
blazing-0.4.0 spec/blazing/dsl_setter_spec.rb
blazing-0.4.0.beta3 spec/blazing/dsl_setter_spec.rb
blazing-0.4.0.beta2 spec/blazing/dsl_setter_spec.rb
blazing-0.4.0.beta1 spec/blazing/dsl_setter_spec.rb
blazing-0.3.0 spec/blazing/dsl_setter_spec.rb
blazing-0.2.14 spec/blazing/dsl_setter_spec.rb
blazing-0.2.13 spec/blazing/dsl_setter_spec.rb
blazing-0.2.12 spec/blazing/dsl_setter_spec.rb
blazing-0.2.11 spec/blazing/dsl_setter_spec.rb