Sha256: 2d499f8302fd3b328cd4ca58c5065d1c4561f90d2e44c716e490abbda0b9b9e8

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Gitscrub::Profile do
  
  before(:each) do
  end

  it "should load the profile" do
    settings = {:level => 1}
    File.should_receive(:exists?).with(Gitscrub::Profile::PROFILE_FILE).and_return(true)
    File.should_receive(:open).with(Gitscrub::Profile::PROFILE_FILE).and_return("settings")
    YAML.should_receive(:load).with("settings").and_return(settings)
    Gitscrub::Profile.should_receive(:new).with(settings)
    Gitscrub::Profile.load
  end

  it "should load the defaults if the file does not exist" do
    defaults = {:level => 0}
    Gitscrub::Profile.should_receive(:new).with(defaults)
    Gitscrub::Profile.load
  end

  it "should allow method acces to getters and setters" do
    profile = Gitscrub::Profile.load
    profile.level.should eql(0)
    profile.level = 1
    profile.level.should eql(1)
  end

  it "should save the file" do
    profile = Gitscrub::Profile.load
    File.should_receive(:open).with(Gitscrub::Profile::PROFILE_FILE, "w")
    profile.save
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gitscrub-0.0.8 spec/gitscrub/profile_spec.rb
gitscrub-0.0.7 spec/gitscrub/profile_spec.rb
gitscrub-0.0.6 spec/gitscrub/profile_spec.rb
gitscrub-0.0.5 spec/gitscrub/profile_spec.rb
gitscrub-0.0.4 spec/gitscrub/profile_spec.rb
gitscrub-0.0.3 spec/gitscrub/profile_spec.rb
gitscrub-0.0.2 spec/gitscrub/profile_spec.rb