Sha256: 93af2f541b0ae04e49d60149dc8ddd1438a655ff5fdf0045a86f27670e5de670

Contents?: true

Size: 1.21 KB

Versions: 21

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'
require 'github_heroku_deployer'
require 'github_heroku_deployer/configuration'

describe GithubHerokuDeployer::Configuration do
  it { should respond_to :"[]" }
  it { should respond_to :to_hash }
  it { should respond_to :merge }

  it "provides default values" do
    assert_config_default :github_repo, ENV["GITHUB_REPO"]
  end

  it "allows values to be overwritten" do
    assert_config_overridable :github_repo
  end

  it "acts like a hash" do
    config = GithubHerokuDeployer::Configuration.new
    hash = config.to_hash
    GithubHerokuDeployer::Configuration::OPTIONS.each_pair do |key, value|
      config[key].should eq(hash[key])
    end
  end

  it "is mergable" do
    config = GithubHerokuDeployer::Configuration.new
    hash = config.to_hash
    config.merge(:key => 'value').should eq(hash.merge(:key => 'value'))
  end

  def assert_config_default(option, default_value, config = nil)
    config ||= GithubHerokuDeployer::Configuration.new
    config.send(option).should eq(default_value)
  end

  def assert_config_overridable(option, value = 'a value')
    config = GithubHerokuDeployer::Configuration.new
    config.send(:"#{option}=", value)
    config.send(option).should eq(value)
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
github_heroku_deployer-0.4.1 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.4.0 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.3.1 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.3.0 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.2.1 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.2.0 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.1.9 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.1.8 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.1.7 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.1.6 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.1.5 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.1.4 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.1.3 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.1.2 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.1.1 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.1.0 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.0.5 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.0.4 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.0.3 spec/lib/github_heroku_deployer/configuration_spec.rb
github_heroku_deployer-0.0.2 spec/lib/github_heroku_deployer/configuration_spec.rb