shipit-engine 0.8.6 → 0.8.7

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: 1dc1f1894044cb766ca0ba066ca7a064ce832721
4
- data.tar.gz: abd419734fa453bf807439d93a1e26bf8403bcd7
3
+ metadata.gz: 74cc484927228d18c31d24f110e2341307e984ef
4
+ data.tar.gz: 808334ec6a06615b548eb0e20e47571fb943599d
5
5
  SHA512:
6
- metadata.gz: d665cb11cb34a3c350e13130162647d3b787987e92a9673607bd771539c1edb5448a6a59a3211dd3a2c2fe4e9666b27d00944efbf9880463216c6ae03e01bcd1
7
- data.tar.gz: 33219abcdc9acaccddd18bc765ce4e8fc2bbb392aaeab90b7dc0ab1c5a4364d764bf790db948e2601f9a353dfff3f3641704ae2f99f229b9a7138f4a64a6e55f
6
+ metadata.gz: 10ea80eaae7515e6850a8c3e690b1b16da2f99e72760c361ea066186039090df31ec9beac04243421026b61f46c72346402dce98481291aee43f9dd286b51e52
7
+ data.tar.gz: 818be40a841487e4d453cfc44ebb9cce0d6b1ba262ebcc1b84a1882af8eccbf50bb65a03c56f25ff68acf214e771e1ff3f2ccb3093ce6790e179b06d6d3de5da
@@ -62,7 +62,11 @@ module Shipit
62
62
 
63
63
  def github_user=(github_user)
64
64
  return unless github_user
65
- github_user = github_user.rels[:self].get.data unless github_user.name
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
@@ -1,3 +1,3 @@
1
1
  module Shipit
2
- VERSION = '0.8.6'
2
+ VERSION = '0.8.7'
3
3
  end
Binary file
@@ -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.6
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-14 00:00:00.000000000 Z
11
+ date: 2016-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake