Sha256: 0f958d42624260a15294b5e34d420eab1485e11519f4687d9519530d9dde6bf7

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require "spec_helper"

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
          ::Rails.stub(root: Pathname.new("/path/to/app"))

          expect {
            ::Rails.stub(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
          ::Rails.stub(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
          ::Rails.stub(env: "development")

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

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
figaro-1.0.0.rc1 spec/figaro/rails/application_spec.rb
mguymon-figaro-0.7.0.1 spec/figaro/rails/application_spec.rb