public
Description: The Git TextMate Bundle
Homepage: http://tim.theenchanter.com/
Clone URL: git://github.com/timcharper/git-tmbundle.git
git-tmbundle / Support / spec / controllers / config_controller_spec.rb
100644 24 lines (19 sloc) 0.799 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require File.dirname(__FILE__) + '/../spec_helper'
 
describe ConfigController do
  include SpecHelpers
  include Parsers
  
  before(:each) do
    @controller = ConfigController.singleton_new
    @git = Git.singleton_new
  end
  
  describe "when setting values" do
    it "should default to local" do
      @git.config.should_receive(:[]=).with("local", "user.name", "My Name")
      capture_output { dispatch(:controller => "config", :action => "set", :key => "user.name", :value => "My Name" )}
    end
  
    it "should allow setting of global variables" do
      @git.config.should_receive(:[]=).with("global", "user.name", "My Name")
      capture_output { dispatch(:controller => "config", :action => "set", :scope => "global", :key => "user.name", :value => "My Name" )}
    end
  end
  
end