Sha256: fbf93149ca3eb2b8254099e0e7f1577de2e02883e44bad4eaebd2911edb8d77d

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

module Figaro
  module Rails
    describe Application do
      describe "#default_path" do
        let!(:application) { Application.new }

        it "defaults to config/application.yml in Rails.root" do
          allow(::Rails).to receive(:root) { Pathname.new("/path/to/app") }

          expect {
            allow(::Rails).to receive(:root) { Pathname.new("/app") }
          }.to change {
            application.send(:default_path).to_s
          }.from("/path/to/app/config/application.yml").to("/app/config/application.yml")
        end

        it "raises an error when Rails.root isn't set yet" do
          allow(::Rails).to receive(:root) { nil }

          expect {
            application.send(:default_path)
          }.to raise_error(RailsNotInitialized)
        end
      end

      describe "#default_environment" do
        let!(:application) { Application.new }

        it "defaults to Rails.env" do
          allow(::Rails).to receive(:env) { "development" }

          expect {
            allow(::Rails).to receive(:env) { "test" }
          }.to change {
            application.send(:default_environment).to_s
          }.from("development").to("test")
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
daqing_figaro-1.2.1 spec/figaro/rails/application_spec.rb
figaro-1.2.0 spec/figaro/rails/application_spec.rb
figaro-1.1.1 spec/figaro/rails/application_spec.rb
figaro-1.1.0 spec/figaro/rails/application_spec.rb
figaro-1.0.0 spec/figaro/rails/application_spec.rb