public
Rubygem
Description: Take FogBugz offline with you
Clone URL: git://github.com/francois/fogbugz_offline.git
francois (author)
Thu May 15 13:51:13 -0700 2008
commit  044a17bdfbcc45cce9cd9bdc861b8719a23cbb90
tree    a85721a5b764576695fc3931f095bf388bef5190
parent  8ac223ce4e400667f391c217c4c8be1aa5ad8fab
fogbugz_offline / spec / login_spec.rb
100644 31 lines (25 sloc) 1.36 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
25
26
27
28
29
30
31
require File.dirname(__FILE__) + "/spec_helper"
 
describe FogbugzOffline::Commands::Login do
  before do
    @login = FogbugzOffline::Commands::Login.new
    FogbugzOffline.stub!(:global).and_return(@global = stub_everything("global"))
    FogbugzOffline.stub!(:connection_to).and_return(@connection = stub_everything("connection"))
  end
 
  it "should grab a Connection from FogbugzOffline#connection_to" do
    FogbugzOffline.should_receive(:connection_to).with("http://fogbugz.project.com/").and_return(@connection)
    @login.run(:url => "http://fogbugz.project.com/", :email => "francois", :password => "my-password")
  end
 
  it "should call Connection#login" do
    @connection.should_receive(:login).with("francois", "my-password").and_return("0123456")
    @login.run(:url => "http://my.project.com", :email => "francois", :password => "my-password")
  end
 
  it "should record the token in the global configuration" do
    @connection.stub!(:login).and_return("0123")
    @global.should_receive(:add_token).with("http://your.project.com/", "0123")
    @login.run(:url => "http://your.project.com/", :email => "francois", :password => "my-password")
  end
 
  it "should write the global configuration" do
    @global.should_receive(:write)
    @login.run(:url => "http://your.project.com/", :email => "francois", :password => "my-password")
  end
end