Sha256: 6c932b3019d9a890a2dfa0a04f14b2d7bcf453dcd5ad7c13bd6d301d1c007041

Contents?: true

Size: 993 Bytes

Versions: 23

Compression:

Stored size: 993 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
      allow(Rails).to receive(:root) { "/path/to/rails_root" }
      ActiveRecord::Base.turntable_config_file = nil
      expect(ActiveRecord::Base.turntable_config_file).to eq("/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
      expect(ActiveRecord::Base.turntable_config_file).to eq(filename)
    end
  end

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

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
activerecord-turntable-2.5.0 spec/active_record/turntable_spec.rb
activerecord-turntable-2.4.0 spec/active_record/turntable_spec.rb
activerecord-turntable-2.3.3 spec/active_record/turntable_spec.rb
activerecord-turntable-2.3.2 spec/active_record/turntable_spec.rb
activerecord-turntable-2.3.1 spec/active_record/turntable_spec.rb
activerecord-turntable-2.3.0 spec/active_record/turntable_spec.rb
activerecord-turntable-2.2.2 spec/active_record/turntable_spec.rb
activerecord-turntable-2.2.1 spec/active_record/turntable_spec.rb
activerecord-turntable-2.2.0 spec/active_record/turntable_spec.rb
activerecord-turntable-2.1.1 spec/active_record/turntable_spec.rb
activerecord-turntable-2.1.0 spec/active_record/turntable_spec.rb
activerecord-turntable-2.1.0.rc2 spec/active_record/turntable_spec.rb
activerecord-turntable-2.1.0.rc1 spec/active_record/turntable_spec.rb
activerecord-turntable-2.1.0.beta2 spec/active_record/turntable_spec.rb
activerecord-turntable-2.1.0.beta1 spec/active_record/turntable_spec.rb
activerecord-turntable-2.0.6 spec/active_record/turntable_spec.rb
activerecord-turntable-2.0.5 spec/active_record/turntable_spec.rb
activerecord-turntable-2.0.4 spec/active_record/turntable_spec.rb
activerecord-turntable-2.0.3 spec/active_record/turntable_spec.rb
activerecord-turntable-2.0.2 spec/active_record/turntable_spec.rb