Sha256: f44bf1fe2c3aa0bfda58f9096fd307770b9148b4be1e5cd7c7163af885eedc7a

Contents?: true

Size: 939 Bytes

Versions: 1

Compression:

Stored size: 939 Bytes

Contents

require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
require 'albacore/albacoremodel'

class ModelTest
  include AlbacoreModel
  attr_accessor :foo, :bar
  attr_hash :a_hash
  attr_array :a_array
end

describe "when updating object attributes with a valid set of hash keys" do
  before :each do
    @model = ModelTest.new
    @model << {:foo => "test", :bar => "whatever"}
  end

  it "should set the attributes correctly" do
    @model.foo.should == "test"
    @model.bar.should == "whatever"
  end
end

describe "when updating an object attributes with an invalid hash key" do
  before :each do
    @model = ModelTest.new
    str = StringIO.new
    @model.log_device = str
    @model << {:something => "broken"}
    @log = str.string
  end

  it "should warn about the attribute not being found" do
    @log.should include("something is not a settable attribute on ModelTest")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
albacore-0.2.0.preview1 spec/albacoremodel_spec.rb