Sha256: 46da6d214928c65713e85d4a24cae27c255237ec36e9764a9f3b618968b76ff6

Contents?: true

Size: 961 Bytes

Versions: 5

Compression:

Stored size: 961 Bytes

Contents

require 'spec_helper'

describe ActiveRecord::Turntable do
  before(:all) do
    ActiveRecord::Base.send(:include, ActiveRecord::Turntable)
  end

  context "#config_file" do
    it "should return Rails.root/config/turntable.yml default" do
      unless defined?(::Rails); class ::Rails; end; end
      stub(Rails).root { "/path/to/rails_root" }
      ActiveRecord::Base.turntable_config_file = nil
      ActiveRecord::Base.turntable_config_file.should == "/path/to/rails_root/config/turntable.yml"
    end
  end

  context "#config_file=" do
    it "should set config_file" do
      ActiveRecord::Base.send(:include, ActiveRecord::Turntable)
      filename = "hogefuga"
      ActiveRecord::Base.turntable_config_file = filename
      ActiveRecord::Base.turntable_config_file.should == filename
    end
  end

  context "#config" do
    subject { ActiveRecord::Base.turntable_config }
    it { should be_instance_of(ActiveRecord::Turntable::Config) }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activerecord-turntable-1.1.2 spec/active_record/turntable_spec.rb
activerecord-turntable-1.1.1 spec/active_record/turntable_spec.rb
activerecord-turntable-1.1.0 spec/active_record/turntable_spec.rb
activerecord-turntable-1.0.1 spec/active_record/turntable_spec.rb
activerecord-turntable-1.0.0 spec/active_record/turntable_spec.rb