spec/figaro/rails/application_spec.rb in figaro-1.0.0.rc1 vs spec/figaro/rails/application_spec.rb in figaro-1.0.0
- old
+ new
@@ -1,25 +1,23 @@
-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"))
+ allow(::Rails).to receive(:root) { Pathname.new("/path/to/app") }
expect {
- ::Rails.stub(root: Pathname.new("/app"))
+ 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
- ::Rails.stub(root: nil)
+ allow(::Rails).to receive(:root) { nil }
expect {
application.send(:default_path)
}.to raise_error(RailsNotInitialized)
end
@@ -27,13 +25,13 @@
describe "#default_environment" do
let!(:application) { Application.new }
it "defaults to Rails.env" do
- ::Rails.stub(env: "development")
+ allow(::Rails).to receive(:env) { "development" }
expect {
- ::Rails.stub(env: "test")
+ allow(::Rails).to receive(:env) { "test" }
}.to change {
application.send(:default_environment).to_s
}.from("development").to("test")
end
end