shipit-engine 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/shipit/user.rb +5 -1
- data/lib/shipit/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/models/users_test.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74cc484927228d18c31d24f110e2341307e984ef
|
4
|
+
data.tar.gz: 808334ec6a06615b548eb0e20e47571fb943599d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10ea80eaae7515e6850a8c3e690b1b16da2f99e72760c361ea066186039090df31ec9beac04243421026b61f46c72346402dce98481291aee43f9dd286b51e52
|
7
|
+
data.tar.gz: 818be40a841487e4d453cfc44ebb9cce0d6b1ba262ebcc1b84a1882af8eccbf50bb65a03c56f25ff68acf214e771e1ff3f2ccb3093ce6790e179b06d6d3de5da
|
data/app/models/shipit/user.rb
CHANGED
@@ -62,7 +62,11 @@ module Shipit
|
|
62
62
|
|
63
63
|
def github_user=(github_user)
|
64
64
|
return unless github_user
|
65
|
-
|
65
|
+
|
66
|
+
if github_user.name.nil? && github_user.rels && github_user.rels[:self]
|
67
|
+
github_user = github_user.rels[:self].get.data
|
68
|
+
end
|
69
|
+
|
66
70
|
assign_attributes(
|
67
71
|
github_id: github_user.id,
|
68
72
|
name: github_user.name || github_user.login, # Name is not mandatory on GitHub
|
data/lib/shipit/version.rb
CHANGED
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/test/models/users_test.rb
CHANGED
@@ -12,6 +12,15 @@ module Shipit
|
|
12
12
|
avatar_url: 'https://avatars.githubusercontent.com/u/42?v=3',
|
13
13
|
url: 'https://api.github.com/user/george',
|
14
14
|
)
|
15
|
+
@minimal_github_user = stub(
|
16
|
+
id: 43,
|
17
|
+
name: nil,
|
18
|
+
login: 'peter',
|
19
|
+
email: nil,
|
20
|
+
avatar_url: 'https://avatars.githubusercontent.com/u/43?v=3',
|
21
|
+
url: 'https://api.github.com/user/peter',
|
22
|
+
rels: nil,
|
23
|
+
)
|
15
24
|
end
|
16
25
|
|
17
26
|
test "find_or_create_from_github persist a new user if he is unknown" do
|
@@ -48,6 +57,11 @@ module Shipit
|
|
48
57
|
assert_equal @github_user.login, user.login
|
49
58
|
end
|
50
59
|
|
60
|
+
test "find_or_create_from_github accepts minimal users without name nor email" do
|
61
|
+
user = User.find_or_create_from_github(@minimal_github_user)
|
62
|
+
assert_equal @minimal_github_user.login, user.login
|
63
|
+
end
|
64
|
+
|
51
65
|
test "#identifiers_for_ping returns a hash with the user's github_id, name, email and github_login" do
|
52
66
|
user = shipit_users(:bob)
|
53
67
|
expected_ouput = {github_id: user.github_id, name: user.name, email: user.email, github_login: user.login}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shipit-engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|