github-auth 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 925a47ece6e17d63b118306d952b7f05de6334dd
|
4
|
+
data.tar.gz: 8994acc3a3c067d7cf60524d2d8da9be40beb77c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4d5eeec641cb3da34d54b38735906030bcca3b9814b069455567045d1ccd07424865572447eb6a4c2538aa4e1dc2b53912d53202d52e7335b850bcf1d474e70
|
7
|
+
data.tar.gz: 291fb365b5d28120baee5ced839a191bf07efbeb263f674dff564732410f48859b84643101d164a0571cc72045eb37b8efdc4018ccb5913daded3098645ed480
|
data/lib/github/auth/version.rb
CHANGED
@@ -3,10 +3,10 @@ require 'support/mock_github_server'
|
|
3
3
|
require 'github/auth'
|
4
4
|
|
5
5
|
describe Github::Auth::CLI do
|
6
|
-
with_mock_github_server do |mock_server_hostname|
|
6
|
+
with_mock_github_server do |mock_server_hostname, mock_keys|
|
7
7
|
let(:hostname) { mock_server_hostname }
|
8
8
|
let(:keys_file) { Tempfile.new 'authorized_keys' }
|
9
|
-
let(:keys) {
|
9
|
+
let(:keys) { mock_keys }
|
10
10
|
|
11
11
|
after { keys_file.unlink }
|
12
12
|
|
@@ -6,17 +6,22 @@ describe Github::Auth::KeysFile do
|
|
6
6
|
it 'writes and deletes keys from the keys file' do
|
7
7
|
tempfile = Tempfile.new 'authorized_keys'
|
8
8
|
keys_file = described_class.new path: tempfile.path
|
9
|
-
keys
|
9
|
+
keys = %w(abc123 def456)
|
10
10
|
|
11
11
|
keys_file.write! keys
|
12
12
|
expect(tempfile.read).to include keys.join("\n")
|
13
13
|
|
14
|
+
tempfile.rewind
|
15
|
+
|
14
16
|
keys_file.delete! keys.first
|
15
|
-
|
17
|
+
tempfile.read.tap do |tempfile_content|
|
18
|
+
expect(tempfile_content).to_not include keys.first
|
19
|
+
expect(tempfile_content).to include keys.last
|
20
|
+
end
|
16
21
|
|
17
|
-
|
18
|
-
expect(tempfile.read).to_not include keys.last
|
22
|
+
tempfile.rewind
|
19
23
|
|
24
|
+
keys_file.delete! keys.last
|
20
25
|
expect(tempfile.read).to be_empty
|
21
26
|
end
|
22
27
|
end
|
@@ -134,5 +134,27 @@ describe Github::Auth::KeysFile do
|
|
134
134
|
expect(keys_file.read).to eq original_keys_file
|
135
135
|
end
|
136
136
|
end
|
137
|
+
|
138
|
+
context 'when the key has a comment' do
|
139
|
+
let(:key) { 'WW6dx9mW/paKl9pznYypl+X617WHP' }
|
140
|
+
let(:comment) { 'this is a comment' }
|
141
|
+
let(:keys) { ["#{key} #{comment}", 'def456'] }
|
142
|
+
let(:other_key) { keys[1] }
|
143
|
+
|
144
|
+
it 'removes the key from the keys file' do
|
145
|
+
subject.delete! key
|
146
|
+
expect(keys_file.read).to_not include key
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'removes the comment from the keys file' do
|
150
|
+
subject.delete! key
|
151
|
+
expect(keys_file.read).to_not include comment
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'does not remove the other key from the keys file' do
|
155
|
+
subject.delete! key
|
156
|
+
expect(keys_file.read).to include other_key
|
157
|
+
end
|
158
|
+
end
|
137
159
|
end
|
138
160
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Hunt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|