gas 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,10 +13,10 @@ describe Gas::Config do
13
13
  end
14
14
 
15
15
  it 'should be able to parse users from config format' do
16
- @config.users.count.should == 2
17
- @config.users[0].name.should == @name
18
- @config.users[0].email.should == @email
19
- @config.users[0].nickname.should == @nickname
16
+ @config.users.count.should be 2
17
+ @config.users[0].name.should eq @name
18
+ @config.users[0].email.should eq @email
19
+ @config.users[0].nickname.should eq @nickname
20
20
  end
21
21
 
22
22
  it 'should output the users in the correct format' do
@@ -45,12 +45,12 @@ describe Gas::Config do
45
45
  user2 = Gas::User.new 'foo', 'bar', 'user2'
46
46
  users = [user1, user2]
47
47
  config = Gas::Config.new users
48
- config.get('walle').should == user1
49
- config.get('user2').should == user2
50
- config['walle'].should == user1
51
- config['user2'].should == user2
52
- config[:walle].should == user1
53
- config[:user2].should == user2
48
+ config.get('walle').should eq user1
49
+ config.get('user2').should eq user2
50
+ config['walle'].should eq user1
51
+ config['user2'].should eq user2
52
+ config[:walle].should eq user1
53
+ config[:user2].should eq user2
54
54
  end
55
55
 
56
56
  it 'should be able to add users' do
@@ -58,9 +58,9 @@ describe Gas::Config do
58
58
  user2 = Gas::User.new 'foo', 'bar', 'user2'
59
59
  users = [user1]
60
60
  config = Gas::Config.new users
61
- config.users.count.should == 1
61
+ config.users.count.should be 1
62
62
  config.add user2
63
- config.users.count.should == 2
63
+ config.users.count.should be 2
64
64
  end
65
65
 
66
66
  it 'should be able to delete users by nickname' do
@@ -68,11 +68,11 @@ describe Gas::Config do
68
68
  user2 = Gas::User.new 'foo', 'bar', 'user2'
69
69
  users = [user1, user2]
70
70
  config = Gas::Config.new users
71
- config.users.count.should == 2
71
+ config.users.count.should be 2
72
72
  config.delete 'walle'
73
- config.users.count.should == 1
73
+ config.users.count.should be 1
74
74
  config.delete 'user2'
75
- config.users.count.should == 0
75
+ config.users.count.should be 0
76
76
  end
77
77
 
78
78
  it 'should remove the ssh keys from .gas appropriately'
@@ -17,15 +17,15 @@ describe Gas::Gitconfig do
17
17
  mock_cli_call(@gitconfig, 'git config --global --get user.email') { @email + "\n" }
18
18
 
19
19
  user = @gitconfig.current_user
20
- user.name.should == @name
21
- user.email.should == @email
20
+ user.name.should eq @name
21
+ user.email.should eq @email
22
22
  end
23
23
 
24
24
  it 'should return nil if no current user is present in gitconfig' do
25
25
  mock_cli_call(@gitconfig, 'git config --global --get user.name') { nil }
26
26
  mock_cli_call(@gitconfig, 'git config --global --get user.email') { nil }
27
27
 
28
- @gitconfig.current_user.should == nil
28
+ @gitconfig.current_user.should be_nil
29
29
  end
30
30
 
31
31
 
@@ -45,9 +45,9 @@ describe Gas::Gitconfig do
45
45
  @gitconfig.change_user @user1
46
46
 
47
47
  user = @gitconfig.current_user
48
- user.name.should == @user1.name
49
- user.email.should == @user1.email
50
- user.nickname.should == @user1.nickname
48
+ user.name.should eq @user1.name
49
+ user.email.should eq @user1.email
50
+ user.nickname.should eq @user1.nickname
51
51
  end
52
52
 
53
53
  it 'should be able to change the current user' do
@@ -64,8 +64,8 @@ describe Gas::Gitconfig do
64
64
  @gitconfig.change_user @user1
65
65
 
66
66
  user = @gitconfig.current_user
67
- user.name.should == @name
68
- user.email.should == @email # test that the user switch worked (paranoid, huh?)
67
+ user.name.should eq @name
68
+ user.email.should eq @email # test that the user switch worked (paranoid, huh?)
69
69
 
70
70
  # User 2 cli interrupt things...
71
71
  mock_cli_call(@gitconfig, "git config --global user.name \"#{name}\"") { nil }
@@ -77,8 +77,8 @@ describe Gas::Gitconfig do
77
77
  @gitconfig.change_user @user2
78
78
 
79
79
  user = @gitconfig.current_user
80
- user.name.should == name
81
- user.email.should == email # test that the user changed appropriately
80
+ user.name.should eq name
81
+ user.email.should eq email # test that the user changed appropriately
82
82
  end
83
83
 
84
84
  end
@@ -0,0 +1,107 @@
1
+ require './spec/spec_helper'
2
+ require './lib/gas'
3
+
4
+
5
+ describe Gas::GithubSpeaker do
6
+
7
+ before :each do
8
+ config = "[#{@nickname}]\n name = #{@name}\n email = #{@email}\n\n[user2]\n name = foo\n email = bar"
9
+ @config = Gas::Config.new nil, config
10
+ @user = @config.users[0]
11
+
12
+ @username = "aTestGitAccount" # be VERY careful when plugging in your own testing account here...
13
+ @password = "plzdon'thackthetestaccount1" # It will delete ALL keys associated with that account if you run the tests
14
+
15
+ @sample_rsa = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDn74QR9yHb+hcid8iH3+FTaEwnKtwjttseJDbIA2PaivN2uvESrvHlp8Ss/cRox3fFu34QR5DpdOhlfULjTX7yKVuxhaNrAJaqg8rX8hgr9U1Botnyy1DBueEyyA3o1fxRkmwTf6FNnkt1BxWP635tD0lbmUubwaadXjQqPOf3Uw=="
16
+
17
+ VCR.use_cassette('instantiate_github_speaker') do
18
+ @github_speaker = Gas::GithubSpeaker.new(@user, @username, @password)
19
+ end
20
+ end
21
+
22
+ describe "test keys" do
23
+
24
+ describe "with no keys..." do
25
+ after :each do
26
+ delete_all_keys_in_github_account!(@github_speaker)
27
+ end
28
+
29
+ it "should post_key! all the way up to github" do
30
+ initial_length = 'VCR introduces scope =('
31
+ final_length = ''
32
+
33
+ VCR.use_cassette('get_keys-find_none') do
34
+ initial_length = get_keys(@username, @password).length
35
+ end
36
+
37
+ VCR.use_cassette('githubspeaker-post_key') do # this test has been saved under fixtures/install-delete-a-key.yml
38
+ @github_speaker.post_key! @sample_rsa
39
+ end
40
+
41
+ VCR.use_cassette('get_keys-find_one') do
42
+ final_length = get_keys(@username, @password).length
43
+ end
44
+
45
+ (final_length - initial_length).should be(1)
46
+ end
47
+
48
+ it "should expose an empty array when no keys..." do
49
+ VCR.use_cassette('check_keys-empty') do
50
+ @github_speaker.keys.empty?.should be_true
51
+ end
52
+ end
53
+
54
+ it "should expose a key created..." do
55
+ VCR.use_cassette('github_speaker-post_key') do
56
+ @github_speaker.post_key! @sample_rsa
57
+ end
58
+
59
+ @github_speaker.keys.empty?.should be_false
60
+ end
61
+ end
62
+
63
+ describe "with a key" do
64
+ before :each do
65
+ VCR.use_cassette('github_speaker-post_key') do
66
+ @github_speaker.post_key! @sample_rsa
67
+ end
68
+
69
+ @key_id = @github_speaker.keys.first['id']
70
+ end
71
+
72
+ after :each do
73
+ delete_all_keys_in_github_account!(@github_speaker)
74
+ end
75
+
76
+ it "should remove_key! from github" do
77
+ initial_length = ''
78
+ final_length = ''
79
+
80
+ VCR.use_cassette('get_keys-find_one') do
81
+ initial_length = get_keys(@username, @password).length
82
+ end
83
+
84
+ VCR.use_cassette('githubspeaker-remove_key') do
85
+ @github_speaker.remove_key! @sample_rsa
86
+ end
87
+
88
+ VCR.use_cassette('get_keys-find_none') do
89
+ final_length = get_keys(@username, @password).length
90
+ end
91
+
92
+ (final_length - initial_length).should be(-1)
93
+ end
94
+
95
+ it "should remove a key from @keys" do
96
+ #require 'pry';binding.pry
97
+ Gas::GithubSpeaker.publicize_methods do
98
+ @github_speaker.remove_key_from_keys @key_id
99
+ end
100
+
101
+ @github_speaker.keys.empty?.should be_true
102
+ end
103
+ end
104
+
105
+ end
106
+
107
+ end
@@ -0,0 +1,56 @@
1
+ require './spec/spec_helper'
2
+
3
+ require './lib/gas'
4
+
5
+ describe Gas::Settings do
6
+
7
+ before(:all) do
8
+ @subject = Gas::Settings.new
9
+ end
10
+
11
+ it 'should respond to base_dir' do
12
+ @subject.should respond_to :base_dir
13
+ end
14
+
15
+ it 'should give default value for base_dir' do
16
+ @subject.base_dir.should == '~'
17
+ end
18
+
19
+ it 'should respond to gas_dir' do
20
+ @subject.should respond_to :gas_dir
21
+ end
22
+
23
+ it 'should give default value for gas_dir' do
24
+ @subject.gas_dir.should == "#{@subject.base_dir}/.gas"
25
+ end
26
+
27
+ it 'should respond to ssh_dir' do
28
+ @subject.should respond_to :ssh_dir
29
+ end
30
+
31
+ it 'should give default value for ssh_dir' do
32
+ @subject.ssh_dir.should == "#{@subject.base_dir}/.ssh"
33
+ end
34
+
35
+ it 'should respond to github_server' do
36
+ @subject.should respond_to :github_server
37
+ end
38
+
39
+ it 'should give default value for github_server' do
40
+ @subject.github_server.should == 'api.github.com'
41
+ end
42
+
43
+ it 'should be configurable' do
44
+ @subject.configure do |s|
45
+ s.base_dir = 'test'
46
+ s.gas_dir = 'foo'
47
+ s.ssh_dir = 'bar'
48
+ s.github_server = 'foobar'
49
+ end
50
+ @subject.base_dir.should eq 'test'
51
+ @subject.gas_dir.should eq "#{@subject.base_dir}/foo"
52
+ @subject.ssh_dir.should eq "#{@subject.base_dir}/bar"
53
+ @subject.github_server.should eq 'foobar'
54
+ end
55
+
56
+ end
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-15 00:00:00.000000000Z
12
+ date: 2012-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &14036680 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 0.14.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *14036680
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.14.6
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: sshkey
27
- requirement: &14032240 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 1.2.2
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *14032240
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.2.2
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: highline
38
- requirement: &14030920 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,31 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *14030920
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: json
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
47
78
  - !ruby/object:Gem::Dependency
48
79
  name: rake
49
- requirement: &14028160 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
50
81
  none: false
51
82
  requirements:
52
83
  - - ! '>='
@@ -54,10 +85,15 @@ dependencies:
54
85
  version: '0'
55
86
  type: :development
56
87
  prerelease: false
57
- version_requirements: *14028160
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
58
94
  - !ruby/object:Gem::Dependency
59
95
  name: bundler
60
- requirement: &14026440 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
61
97
  none: false
62
98
  requirements:
63
99
  - - ! '>='
@@ -65,10 +101,15 @@ dependencies:
65
101
  version: '0'
66
102
  type: :development
67
103
  prerelease: false
68
- version_requirements: *14026440
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
69
110
  - !ruby/object:Gem::Dependency
70
111
  name: rspec
71
- requirement: &14023560 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
72
113
  none: false
73
114
  requirements:
74
115
  - - ! '>='
@@ -76,10 +117,15 @@ dependencies:
76
117
  version: '0'
77
118
  type: :development
78
119
  prerelease: false
79
- version_requirements: *14023560
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
80
126
  - !ruby/object:Gem::Dependency
81
127
  name: rr
82
- requirement: &14022040 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
83
129
  none: false
84
130
  requirements:
85
131
  - - ! '>='
@@ -87,7 +133,44 @@ dependencies:
87
133
  version: '0'
88
134
  type: :development
89
135
  prerelease: false
90
- version_requirements: *14022040
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: vcr
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: pry
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
91
174
  description: Gas is a utility to keep track of your git authors. Add them to gas and
92
175
  switch at any time. Great if you use one author at work and one at home or if you
93
176
  are doing pair programming. Includes SSH support.
@@ -100,17 +183,22 @@ extra_rdoc_files:
100
183
  - LICENSE
101
184
  files:
102
185
  - bin/gas
103
- - lib/gas.rb
104
- - lib/gas/version.rb
186
+ - lib/gas/config.rb
187
+ - lib/gas/gitconfig.rb
188
+ - lib/gas/github_speaker.rb
189
+ - lib/gas/prompter.rb
190
+ - lib/gas/settings.rb
105
191
  - lib/gas/ssh.rb
106
192
  - lib/gas/user.rb
107
- - lib/gas/gitconfig.rb
108
- - lib/gas/config.rb
193
+ - lib/gas/version.rb
194
+ - lib/gas.rb
195
+ - spec/integration/ssh_spec.rb
109
196
  - spec/spec_helper.rb
110
- - spec/gas/user_spec.rb
111
- - spec/gas/ssh_spec.rb
112
- - spec/gas/config_spec.rb
113
- - spec/gas/gitconfig_spec.rb
197
+ - spec/unit/config_spec.rb
198
+ - spec/unit/gitconfig_spec.rb
199
+ - spec/unit/github_speaker_spec.rb
200
+ - spec/unit/settings_spec.rb
201
+ - spec/unit/user_spec.rb
114
202
  - LICENSE
115
203
  - README.textile
116
204
  homepage: https://github.com/walle/gas
@@ -128,7 +216,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
216
  version: '0'
129
217
  segments:
130
218
  - 0
131
- hash: 3442034922902480779
219
+ hash: 1919630044039596509
132
220
  required_rubygems_version: !ruby/object:Gem::Requirement
133
221
  none: false
134
222
  requirements:
@@ -137,11 +225,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
225
  version: '0'
138
226
  segments:
139
227
  - 0
140
- hash: 3442034922902480779
228
+ hash: 1919630044039596509
141
229
  requirements: []
142
230
  rubyforge_project: gas
143
- rubygems_version: 1.8.6
231
+ rubygems_version: 1.8.24
144
232
  signing_key:
145
233
  specification_version: 3
146
234
  summary: Manage your git author accounts
147
235
  test_files: []
236
+ has_rdoc: