Sha256: 3fa40de842e2270b9f8f4c0dcf7a0ed42b35244f6f519ac9eb85f32ebfd4f946

Contents?: true

Size: 1.55 KB

Versions: 20

Compression:

Stored size: 1.55 KB

Contents

require File.dirname(__FILE__) + '/test_helper'

describe "Braid::Config, when empty" do
  before(:each) do
    @config = Braid::Config.new("tmp.yml")
  end

  after(:each) do
    FileUtils.rm("tmp.yml") rescue nil
  end

  it "should not get a mirror by name" do
    @config.get("path").should be_nil
    lambda { @config.get!("path") }.should raise_error(Braid::Config::MirrorDoesNotExist)
  end

  it "should add a mirror and its params" do
    @mirror = build_mirror
    @config.add(@mirror)
    @config.get("path").path.should_not be_nil
  end
end

describe "Braid::Config, with one mirror" do
  before(:each) do
    @config = Braid::Config.new("tmp.yml")
    @mirror = build_mirror
    @config.add(@mirror)
  end

  after(:each) do
    FileUtils.rm("tmp.yml") rescue nil
  end

  it "should get the mirror by name" do
    @config.get("path").should == @mirror
    @config.get!("path").should == @mirror
  end

  it "should raise when trying to overwrite a mirror on add" do
    lambda { @config.add(@mirror) }.should raise_error(Braid::Config::PathAlreadyInUse)
  end

  it "should remove the mirror" do
    @config.remove(@mirror)
    @config.get("path").should be_nil
  end

  it "should update the mirror with new params" do
    @mirror.branch = "other"
    @config.update(@mirror)
    @config.get("path").attributes.should == {"branch" => "other"}
  end

  it "should raise when trying to update nonexistent mirror" do
    @mirror.instance_variable_set("@path", "other")
    lambda { @config.update(@mirror) }.should raise_error(Braid::Config::MirrorDoesNotExist)
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
braid-1.0.8 spec/config_spec.rb
braid-1.0.7 spec/config_spec.rb
braid-1.0.6 spec/config_spec.rb
braid-1.0.5 spec/config_spec.rb
braid-1.0.4 spec/config_spec.rb
braid-1.0.3 spec/config_spec.rb
braid-1.0.2 spec/config_spec.rb
braid-1.0.1 spec/config_spec.rb
braid-1.0.0 spec/config_spec.rb
realityforge-braid-0.9.9 spec/config_spec.rb
realityforge-braid-0.9.8 spec/config_spec.rb
realityforge-braid-0.9.7 spec/config_spec.rb
realityforge-braid-0.9.6 spec/config_spec.rb
realityforge-braid-0.9.5 spec/config_spec.rb
realityforge-braid-0.9.4 spec/config_spec.rb
realityforge-braid-0.9.3 spec/config_spec.rb
realityforge-braid-0.9.2 spec/config_spec.rb
realityforge-braid-0.9.1 spec/config_spec.rb
realityforge-braid-0.9.0 spec/config_spec.rb
realityforge-braid-0.8.0 spec/config_spec.rb