Sha256: e8d4a19f86f67a1ad27f8fb1d2244dd6ea449b87fba87c770d0ab947070a58be

Contents?: true

Size: 1.75 KB

Versions: 4

Compression:

Stored size: 1.75 KB

Contents

require "spec_helper"

describe Figaro::Tasks do
  describe ".heroku" do
    it "configures Heroku" do
      Figaro.stub(:vars => "FOO=bar")

      Figaro::Tasks.should_receive(:`).once.with("heroku config:get RAILS_ENV").
        and_return("development\n")
      Figaro::Tasks.should_receive(:`).once.with("heroku config:add FOO=bar")

      Figaro::Tasks.heroku
    end

    it "configures a specific Heroku app" do
      Figaro.stub(:vars => "FOO=bar")

      Figaro::Tasks.should_receive(:`).once.
        with("heroku config:get RAILS_ENV --app my-app").
        and_return("development\n")
      Figaro::Tasks.should_receive(:`).once.
        with("heroku config:add FOO=bar --app my-app")

      Figaro::Tasks.heroku("my-app")
    end

    it "respects the Heroku's remote Rails environment" do
      Figaro::Tasks.stub(:`).with("heroku config:get RAILS_ENV").
        and_return("production\n")

      Figaro.should_receive(:vars).once.with("production").and_return("FOO=bar")
      Figaro::Tasks.should_receive(:`).once.with("heroku config:add FOO=bar")

      Figaro::Tasks.heroku
    end

    it "defaults to the local Rails environment if not set remotely" do
      Figaro::Tasks.stub(:`).with("heroku config:get RAILS_ENV").
        and_return("\n")

      Figaro.should_receive(:vars).once.with(nil).and_return("FOO=bar")
      Figaro::Tasks.should_receive(:`).once.with("heroku config:add FOO=bar")

      Figaro::Tasks.heroku
    end

    describe "figaro:heroku", :rake => true do
      it "configures Heroku" do
        Figaro::Tasks.should_receive(:heroku).once.with(nil)

        task.invoke
      end

      it "configures a specific Heroku app" do
        Figaro::Tasks.should_receive(:heroku).once.with("my-app")

        task.invoke("my-app")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
figaro-0.6.1 spec/figaro/tasks_spec.rb
figaro-0.6.0 spec/figaro/tasks_spec.rb
figaro-0.5.4 spec/figaro/tasks_spec.rb
figaro-0.5.3 spec/figaro/tasks_spec.rb