Sha256: 102f3dd29e45e760d1eeb339de193aae83077e3e72095518aedca7b1f220e761

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe Blueprints::Configuration do
  before do
    @config = Blueprints::Configuration.new
  end

  it "should have filename with default value" do
    @config.filename.should == %w{blueprint.rb blueprint/*.rb spec/blueprint.rb spec/blueprint/*.rb test/blueprint.rb test/blueprint/*.rb}.collect do |f|
      Pathname.new(f)
    end
  end

  it "should have correct attribute values" do\
    @config.prebuild.should == []
    @config.transactions.should be_true
    @config.root.should == Pathname.pwd
  end

  it "should use Rails root for root if it's defined" do
    module Rails
      def self.root
        Pathname.new('rails/root')
      end
    end
    Blueprints::Configuration.new.root.should == Pathname.new('rails/root')
    Object.send(:remove_const, :Rails)
  end

  it "should set root to pathname" do
    @config.root = "root"
    @config.root.should == Pathname.new("root")
  end

  it "should automatically set filename to array of path names" do
    @config.filename = "my_file.rb"
    @config.filename.should == [Pathname.new("my_file.rb")]
  end

  describe "default attributes" do
    it "should be name by default" do
      @config.default_attributes.should == [:name]
    end

    it "should automatically convert them to array" do
      @config.default_attributes = :id
      @config.default_attributes.should == [:id]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blueprints-1.0.1 spec/unit/configuration_spec.rb
blueprints-1.0.0 spec/unit/configuration_spec.rb
blueprints-0.9.0 spec/unit/configuration_spec.rb