Sha256: 98d2c4ac61121a8e3e346ab527a4081264613c20b3835fb63ac29bca7dc685c3

Contents?: true

Size: 708 Bytes

Versions: 4

Compression:

Stored size: 708 Bytes

Contents

require 'spec_helper'

describe Factory::Attribute::Static do
  before do
    @name  = :first_name
    @value = 'John'
    @attr  = Factory::Attribute::Static.new(@name, @value)
  end

  it "should have a name" do
    @attr.name.should == @name
  end

  it "should set its static value on a proxy" do
    @proxy = "proxy"
    mock(@proxy).set(@name, @value)
    @attr.add_to(@proxy)
  end

  it "should raise an error when defining an attribute writer" do
    lambda {
      Factory::Attribute::Static.new('test=', nil)
    }.should raise_error(Factory::AttributeDefinitionError)
  end

  it "should convert names to symbols" do
    Factory::Attribute::Static.new('name', nil).name.should == :name
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
factory_girl-1.3.3 spec/factory_girl/attribute/static_spec.rb
factory_girl-1.3.2 spec/factory_girl/attribute/static_spec.rb
factory_girl-1.3.1 spec/factory_girl/attribute/static_spec.rb
factory_girl-1.3.0 spec/factory_girl/attribute/static_spec.rb