Sha256: 7b4d89bde1b6bcd206d2aeef5512acd5cab327b5c4e6643ef4e43b7375447ee2

Contents?: true

Size: 1.29 KB

Versions: 10

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'
require 'albacore/albacoretask'

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

class NamedTaskExample
  TaskName = [:namedtask, :anothername]
  include Albacore::Task
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

describe "when an class includes albacoretask" do
  it "should create a rake task for that class" do
    respond_to?(:modeltest).should be_true
  end
end

describe "when an albacoretask class specifies task names" do
  it "should create a task with the specified names" do
    respond_to?(:namedtask).should be_true
    respond_to?(:anothername).should be_true
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
albacore-0.3.6 spec/albacoremodel_spec.rb
albacore-1.0.0.rc.2 spec/albacoremodel_spec.rb
albacore-1.0.0.rc.1 spec/albacoremodel_spec.rb
albacore-0.3.5 spec/albacoremodel_spec.rb
albacore-0.3.4 spec/albacoremodel_spec.rb
albacore-0.3.3 spec/albacoremodel_spec.rb
albacore-0.3.2 spec/albacoremodel_spec.rb
albacore-0.3.1 spec/albacoremodel_spec.rb
albacore-0.3.0 spec/albacoremodel_spec.rb
albacore-0.2.6 spec/albacoremodel_spec.rb