learn-test 1.2.21 → 1.2.22

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: d19200de7476d7e20ad8d5264e569532226c853d
4
- data.tar.gz: 6f64fc4e55e79a4ba86fb50ca838e053b799a22b
3
+ metadata.gz: b750248ec1419c5bde148b4491e4b73825029dfc
4
+ data.tar.gz: dfeccbf8ccbab5551e84ebde7d5ff49aadacec85
5
5
  SHA512:
6
- metadata.gz: c9b269a3cc397683274e70eb858c5dc8db5d6268ad00b0e881854e989b2445c56856517ca2f3c81e23a72d372f36eefac8f4fe8bc8f29ec96e33b96c2229dded
7
- data.tar.gz: b11ac5893b9c0d3db5d8c8aa6528ba8b5745f81cb893000c4897affdb7521bd14ac7076bba4653e8bf2b5feaf91f69acbf487baec38754bafb1f28b87e2d5e1a
6
+ metadata.gz: f6cf3e0bc9b8f4d8b3eae972b6070f6147c1480d0b1e84d937f29b9823dabd1e7219b3d8ac2b1a07067d8b66cce4b74a243ec874f4e1dd9a3c7f9574d0cc8b88
7
+ data.tar.gz: 9fb15f5cf7ab972d02e47f48e1e83932ca160cfe91feea7eae74aa497b31b53b21258d7de4fe40414e40338562e69e5132f3d73fa765ecd046824551a5c5f4dd
@@ -6,7 +6,7 @@ module LearnTest
6
6
  begin
7
7
  repo = Git.open(FileUtils.pwd)
8
8
  rescue
9
- puts "Not a valid Git repository"
9
+ puts "You don't appear to be in a Learn lesson's directory. Please cd to an appropriate directory and try again."
10
10
  die
11
11
  end
12
12
 
@@ -67,11 +67,11 @@ module LearnTest
67
67
  end
68
68
 
69
69
  def set_json_output
70
- self.json_output = File.read('.results.json')
70
+ self.json_output = File.exists?('.results.json') ? File.read('.results.json') : nil
71
71
  end
72
72
 
73
73
  def jsonify
74
- self.parsed_output = Oj.load(json_output, symbol_keys: true)
74
+ self.parsed_output = json_output ? Oj.load(json_output, symbol_keys: true) : nil
75
75
  end
76
76
 
77
77
  def format_results
@@ -101,10 +101,14 @@ module LearnTest
101
101
  end
102
102
 
103
103
  def push_results
104
- connection.post do |req|
105
- req.url SERVICE_ENDPOINT
106
- req.headers['Content-Type'] = 'application/json'
107
- req.body = Oj.dump(formatted_results, mode: :compat)
104
+ begin
105
+ connection.post do |req|
106
+ req.url SERVICE_ENDPOINT
107
+ req.headers['Content-Type'] = 'application/json'
108
+ req.body = Oj.dump(formatted_results, mode: :compat)
109
+ end
110
+ rescue Faraday::ConnectionFailed
111
+ puts 'There was a problem connecting to Learn. Not pushing test results.'
108
112
  end
109
113
  end
110
114
 
@@ -1,3 +1,3 @@
1
1
  module LearnTest
2
- VERSION = '1.2.21'
2
+ VERSION = '1.2.22'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: learn-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.21
4
+ version: 1.2.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flatiron School
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-09 00:00:00.000000000 Z
11
+ date: 2015-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler