blinka-reporter 0.3.1 → 0.3.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/blinka_client.rb +19 -2
  3. metadata +15 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56e193271a3f7ffc8d089ac8e4484edb68e7a8783a1b138ceee55ba667b720e2
4
- data.tar.gz: 70dfd466a32dba39ea0d0d28713ed979d56cdbc2cc5451cf35b54464c3ecf42e
3
+ metadata.gz: 9db36c14f19ef2d7697dc175f050648686bb3364a9af178253d19ecc7af25c2b
4
+ data.tar.gz: f4988109d5c1df6c708fd595970c59d3aec179a4fce8b170792a07492061ccb0
5
5
  SHA512:
6
- metadata.gz: 2f1bd80ac40f5d2b68a6a72ff166d490835c4c58996d2019d4309cc0806ca19c7588f26f0930c8dbf25f099f7c195c06f191eb2852c4f025e266896356c9c049
7
- data.tar.gz: 55abf722700a5a475d1e24fd93a7885c57a6b6272cc383c975b33e7707ae4df415f6560e3a00d9387da7d1dcd60830ec6589b4fee6439e713477e344b1aef501
6
+ metadata.gz: 5e79caca1a875bf579bde5dc0c306e7ec56265d15a41b86b6a0b0df61c1161eee24774d8f3063893b32d8034b25c1b89e9fe0aae45f0a9fedcca9b423a6086b2
7
+ data.tar.gz: cde67e49366ddcfdf564478664fae6cb1e6445a7bcc2c9a3782a0f651d30b70c1274b29c22b51d98fde4907c3ea7f93e7bf7a3702e1670a06ba8185b3cbfae3c
data/lib/blinka_client.rb CHANGED
@@ -2,6 +2,10 @@ require 'mimemagic'
2
2
  require 'httparty'
3
3
 
4
4
  class BlinkaClient
5
+ DEFAULT_HOST = 'https://www.blinka.app'.freeze
6
+
7
+ include HTTParty
8
+
5
9
  class BlinkaConfig
6
10
  attr_reader(
7
11
  :tag,
@@ -12,8 +16,9 @@ class BlinkaClient
12
16
  :team_secret,
13
17
  :jwt_token
14
18
  )
19
+
15
20
  def initialize
16
- @host = ENV.fetch('BLINKA_HOST', 'https://www.blinka.app')
21
+ @host = ENV.fetch('BLINKA_HOST', DEFAULT_HOST)
17
22
  @team_id = ENV.fetch('BLINKA_TEAM_ID', nil)
18
23
  @team_secret = ENV.fetch('BLINKA_TEAM_SECRET', nil)
19
24
  @repository = ENV.fetch('BLINKA_REPOSITORY', nil)
@@ -32,7 +37,6 @@ class BlinkaClient
32
37
  end
33
38
 
34
39
  class BlinkaError < StandardError; end
35
- include HTTParty
36
40
 
37
41
  def initialize
38
42
  @config = BlinkaConfig.new
@@ -46,6 +50,12 @@ class BlinkaClient
46
50
  'Could not find blinka_results.json, did tests run with environment variable BLINKA_JSON=true set?'
47
51
  )
48
52
  end
53
+
54
+ if ENV.fetch('BLINKA_ALLOW_WEBMOCK_DISABLE', 'true') == 'true' &&
55
+ defined?(WebMock) && WebMock.respond_to?(:disable!)
56
+ WebMock.disable!
57
+ end
58
+
49
59
  self.authenticate
50
60
  data = JSON.parse(File.open(filepath).read)
51
61
 
@@ -100,6 +110,13 @@ class BlinkaClient
100
110
  Failed to create report because of #{error.class} with message:
101
111
  #{error.message}
102
112
  EOS
113
+ ensure
114
+ WebMock.enable! if defined?(WebMock) && WebMock.respond_to?(:enable!)
115
+ end
116
+
117
+ def self.report(filepath: './blinka_results.json')
118
+ client = BlinkaClient.new
119
+ client.report(filepath: filepath)
103
120
  end
104
121
 
105
122
  def self.upload_image(filepath:)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blinka-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Wessman
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '13'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.11'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.11'
97
111
  description: Use to format test results from Minitest to use with Blinka.
98
112
  email: david@wessman.co
99
113
  executables: []