errbit_plugin 0.6.0 → 0.7.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.
@@ -1,6 +1,8 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
2
 
3
- describe ErrbitPlugin::Registry do
3
+ require "spec_helper"
4
+
5
+ RSpec.describe ErrbitPlugin::Registry do
4
6
  before do
5
7
  ErrbitPlugin::Registry.clear_issue_trackers
6
8
  end
@@ -8,7 +10,7 @@ describe ErrbitPlugin::Registry do
8
10
  let(:tracker) {
9
11
  tracker = Class.new(ErrbitPlugin::IssueTracker) do
10
12
  def self.label
11
- 'something'
13
+ "something"
12
14
  end
13
15
  end
14
16
  tracker
@@ -17,19 +19,19 @@ describe ErrbitPlugin::Registry do
17
19
  describe ".add_issue_tracker" do
18
20
  context "with issue_tracker class valid" do
19
21
  before do
20
- allow(ErrbitPlugin::ValidateIssueTracker)
22
+ allow(ErrbitPlugin::IssueTrackerValidator)
21
23
  .to receive(:new)
22
24
  .with(tracker)
23
- .and_return(double(:valid? => true, :message => ''))
25
+ .and_return(double(valid?: true, message: ""))
24
26
  end
25
- it 'add new issue_tracker plugin' do
27
+ it "add new issue_tracker plugin" do
26
28
  ErrbitPlugin::Registry.add_issue_tracker(tracker)
27
29
  expect(ErrbitPlugin::Registry.issue_trackers).to eq({
28
- 'something' => tracker
30
+ "something" => tracker
29
31
  })
30
32
  end
31
33
  context "with already issue_tracker with this key" do
32
- it 'raise ErrbitPlugin::AlreadyRegisteredError' do
34
+ it "raise ErrbitPlugin::AlreadyRegisteredError" do
33
35
  ErrbitPlugin::Registry.add_issue_tracker(tracker)
34
36
  expect {
35
37
  ErrbitPlugin::Registry.add_issue_tracker(tracker)
@@ -39,26 +41,26 @@ describe ErrbitPlugin::Registry do
39
41
  end
40
42
 
41
43
  context "with an IssueTracker not valid" do
42
- it 'raise an IncompatibilityError' do
43
- allow(ErrbitPlugin::ValidateIssueTracker)
44
+ it "raise an IncompatibilityError" do
45
+ allow(ErrbitPlugin::IssueTrackerValidator)
44
46
  .to receive(:new)
45
47
  .with(tracker)
46
- .and_return(double(:valid? => false, :message => 'foo', :errors => []))
48
+ .and_return(double(valid?: false, message: "foo", errors: []))
47
49
  expect {
48
50
  ErrbitPlugin::Registry.add_issue_tracker(tracker)
49
51
  }.to raise_error(ErrbitPlugin::IncompatibilityError)
50
52
  end
51
53
 
52
- it 'puts the errors in the exception message' do
53
- allow(ErrbitPlugin::ValidateIssueTracker)
54
+ it "puts the errors in the exception message" do
55
+ allow(ErrbitPlugin::IssueTrackerValidator)
54
56
  .to receive(:new)
55
57
  .with(tracker)
56
- .and_return(double(:valid? => false, :message => 'foo', :errors => ['one', 'two']))
58
+ .and_return(double(valid?: false, message: "foo", errors: ["one", "two"]))
57
59
 
58
60
  begin
59
61
  ErrbitPlugin::Registry.add_issue_tracker(tracker)
60
62
  rescue ErrbitPlugin::IncompatibilityError => e
61
- expect(e.message).to eq('one; two')
63
+ expect(e.message).to eq("one; two")
62
64
  end
63
65
  end
64
66
  end
data/spec/spec_helper.rb CHANGED
@@ -1,26 +1,25 @@
1
- if ENV['COVERAGE']
2
- require 'simplecov'
3
- if ENV['CI']
4
- require 'coveralls'
5
- Coveralls.wear!
6
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
7
- SimpleCov::Formatter::HTMLFormatter,
8
- Coveralls::SimpleCov::Formatter
9
- ]
10
- end
1
+ # frozen_string_literal: true
2
+
3
+ require "simplecov"
4
+
5
+ SimpleCov.start do
6
+ enable_coverage :branch
7
+
8
+ primary_coverage :branch
11
9
 
12
- SimpleCov.start
10
+ add_filter "spec/"
13
11
  end
14
12
 
15
- require 'errbit_plugin'
13
+ require "errbit_plugin"
16
14
 
17
15
  RSpec.configure do |config|
18
- config.run_all_when_everything_filtered = true
19
- config.filter_run :focus
20
-
21
- # Run specs in random order to surface order dependencies. If you find an
22
- # order dependency and want to debug it, you can fix the order by providing
23
- # the seed, which is printed after each run.
24
- # --seed 1234
25
- config.order = 'random'
16
+ # Enable flags like --only-failures and --next-failure
17
+ config.example_status_persistence_file_path = ".rspec_status"
18
+
19
+ # Disable RSpec exposing methods globally on `Module` and `main`
20
+ config.disable_monkey_patching!
21
+
22
+ config.expect_with :rspec do |c|
23
+ c.syntax = :expect
24
+ end
26
25
  end
metadata CHANGED
@@ -1,43 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: errbit_plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Crosby
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2016-02-26 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.3'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.3'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
41
12
  description: Base to create an errbit plugin
42
13
  email:
43
14
  - stevecrozz@gmail.com
@@ -45,11 +16,16 @@ executables: []
45
16
  extensions: []
46
17
  extra_rdoc_files: []
47
18
  files:
48
- - ".coveralls.yml"
19
+ - ".envrc"
20
+ - ".github/workflows/jruby.yml"
21
+ - ".github/workflows/rspec.yml"
49
22
  - ".gitignore"
50
- - ".travis.yml"
23
+ - ".rspec"
24
+ - ".rubocop.yml"
25
+ - ".ruby-version"
26
+ - ".standard.yml"
51
27
  - Gemfile
52
- - Guardfile
28
+ - Gemfile.lock
53
29
  - LICENSE
54
30
  - LICENSE.txt
55
31
  - README.md
@@ -57,22 +33,26 @@ files:
57
33
  - errbit_plugin.gemspec
58
34
  - lib/errbit_plugin.rb
59
35
  - lib/errbit_plugin/issue_tracker.rb
60
- - lib/errbit_plugin/issue_trackers/none.rb
36
+ - lib/errbit_plugin/issue_tracker_validator.rb
37
+ - lib/errbit_plugin/none_issue_tracker.rb
61
38
  - lib/errbit_plugin/registry.rb
62
- - lib/errbit_plugin/validate_issue_tracker.rb
63
39
  - lib/errbit_plugin/version.rb
40
+ - spec/errbit_plugin/issue_tracker_validator_spec.rb
41
+ - spec/errbit_plugin/none_issue_tracker_spec.rb
64
42
  - spec/errbit_plugin/registry_spec.rb
65
- - spec/errbit_plugin/validate_issue_tracker_spec.rb
66
43
  - spec/spec_helper.rb
67
44
  - static/fake_create.png
68
45
  - static/fake_inactive.png
69
46
  - static/none_create.png
70
47
  - static/none_inactive.png
71
- homepage: http://github.com/errbit/errbit
48
+ homepage: https://github.com/errbit/errbit_plugin
72
49
  licenses:
73
50
  - MIT
74
- metadata: {}
75
- post_install_message:
51
+ metadata:
52
+ homepage_uri: https://github.com/errbit/errbit_plugin
53
+ source_code_uri: https://github.com/errbit/errbit_plugin
54
+ bug_tracker_uri: https://github.com/errbit/errbit_plugin/issues
55
+ rubygems_mfa_required: 'true'
76
56
  rdoc_options: []
77
57
  require_paths:
78
58
  - lib
@@ -80,20 +60,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
60
  requirements:
81
61
  - - ">="
82
62
  - !ruby/object:Gem::Version
83
- version: '0'
63
+ version: 3.1.0
84
64
  required_rubygems_version: !ruby/object:Gem::Requirement
85
65
  requirements:
86
66
  - - ">="
87
67
  - !ruby/object:Gem::Version
88
68
  version: '0'
89
69
  requirements: []
90
- rubyforge_project:
91
- rubygems_version: 2.2.2
92
- signing_key:
70
+ rubygems_version: 3.6.7
93
71
  specification_version: 4
94
72
  summary: Base to create an errbit plugin
95
- test_files:
96
- - spec/errbit_plugin/registry_spec.rb
97
- - spec/errbit_plugin/validate_issue_tracker_spec.rb
98
- - spec/spec_helper.rb
99
- has_rdoc:
73
+ test_files: []
data/.coveralls.yml DELETED
@@ -1,2 +0,0 @@
1
- service_name: travis-pro
2
- repo_token: gNB8KeAdYQKNW2YC4uut6Zh2ToBnPyMqB
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- language: ruby
2
- env:
3
- - COVERAGE=true
4
- before_install:
5
- - gem install bundler
6
- script: bundle exec rspec spec
7
- rvm:
8
- - 2.1
9
- - 2.2
10
- - 2.3.0
11
- - rbx-2
12
- - ruby-head
13
- matrix:
14
- allow_failures:
15
- - rvm: ruby-head
data/Guardfile DELETED
@@ -1,8 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard 'rspec' do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
8
- end
@@ -1,31 +0,0 @@
1
- module ErrbitPlugin
2
- class NoneIssueTracker < IssueTracker
3
- def self.label; 'none'; end
4
- def self.note
5
- 'When no issue tracker has been configured, you will be able to ' <<
6
- 'leave comments on errors.'
7
- end
8
- def self.fields; {}; end
9
- def self.icons
10
- @icons ||= {
11
- create: ['image/png', read_static_file('none_create.png')],
12
- goto: ['image/png', read_static_file('none_create.png')],
13
- inactive: ['image/png', read_static_file('none_inactive.png')],
14
- }
15
- end
16
- def self.read_static_file(file)
17
- File.read(File.expand_path(File.join(
18
- File.dirname(__FILE__), '..', '..', '..', 'static', file)))
19
- end
20
- ##
21
- # The NoneIssueTracker is mark like configured? false because it not valid
22
- # like a real IssueTracker
23
- def configured?; false; end
24
- def errors; {}; end
25
- def url; ''; end
26
- def create_issue(*); false; end
27
- def close_issue(*); false; end
28
- end
29
- end
30
-
31
- ErrbitPlugin::Registry.add_issue_tracker(ErrbitPlugin::NoneIssueTracker)
@@ -1,255 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ErrbitPlugin::ValidateIssueTracker do
4
- describe "#valid?" do
5
-
6
- context "with a complete class" do
7
- klass = Class.new(ErrbitPlugin::IssueTracker) do
8
- def self.label; 'foo'; end
9
- def self.note; 'foo'; end
10
- def self.fields; ['foo']; end
11
- def self.icons; {}; end
12
- def configured?; true; end
13
- def errors; true; end
14
- def create_issue; 'http'; end
15
- def close_issue; 'http'; end
16
- def url; 'http'; end
17
- end
18
-
19
- it 'valid' do
20
- expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be true
21
- end
22
- end
23
-
24
- context "with class not inherit from ErrbitPlugin::IssueTracker" do
25
- klass = Class.new do
26
- def self.label; 'foo'; end
27
- def self.note; 'foo'; end
28
- def self.fields; ['foo']; end
29
- def self.icons; {}; end
30
- def initialize(params); end
31
- def configured?; true; end
32
- def errors; true; end
33
- def create_issue; 'http'; end
34
- def close_issue; 'http'; end
35
- def url; 'http'; end
36
- end
37
-
38
- it 'not valid' do
39
- expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
40
- end
41
-
42
- it 'says :not_inherited' do
43
- is = ErrbitPlugin::ValidateIssueTracker.new(klass)
44
- is.valid?
45
- expect(is.errors).to eql [[:not_inherited]]
46
- end
47
- end
48
-
49
- context "with no label method" do
50
- klass = Class.new(ErrbitPlugin::IssueTracker) do
51
- def self.note; 'foo'; end
52
- def self.fields; ['foo']; end
53
- def self.icons; {}; end
54
- def configured?; true; end
55
- def errors; true; end
56
- def create_issue; 'http'; end
57
- def close_issue; 'http'; end
58
- def url; 'http'; end
59
- end
60
-
61
- it 'not valid' do
62
- expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
63
- end
64
-
65
- it 'say not implement label method' do
66
- is = ErrbitPlugin::ValidateIssueTracker.new(klass)
67
- is.valid?
68
- expect(is.errors).to eql [[:class_method_missing, :label]]
69
- end
70
- end
71
-
72
- context "with no icons method" do
73
- klass = Class.new(ErrbitPlugin::IssueTracker) do
74
- def self.note; 'foo'; end
75
- def self.fields; ['foo']; end
76
- def self.label; 'alabel'; end
77
- def configured?; true; end
78
- def errors; true; end
79
- def create_issue; 'http'; end
80
- def close_issue; 'http'; end
81
- def url; 'http'; end
82
- end
83
-
84
- it 'not valid' do
85
- expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
86
- end
87
-
88
- it 'say not implement icons method' do
89
- is = ErrbitPlugin::ValidateIssueTracker.new(klass)
90
- is.valid?
91
- expect(is.errors).to eql [[:class_method_missing, :icons]]
92
- end
93
- end
94
-
95
- context "without fields method" do
96
- klass = Class.new(ErrbitPlugin::IssueTracker) do
97
- def self.label; 'foo'; end
98
- def self.note; 'foo'; end
99
- def self.icons; {}; end
100
- def configured?; true; end
101
- def errors; true; end
102
- def create_issue; 'http'; end
103
- def close_issue; 'http'; end
104
- def url; 'http'; end
105
- end
106
-
107
- it 'not valid' do
108
- expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
109
- end
110
-
111
- it 'say not implement fields method' do
112
- is = ErrbitPlugin::ValidateIssueTracker.new(klass)
113
- is.valid?
114
- expect(is.errors).to eql [[:class_method_missing, :fields]]
115
- end
116
- end
117
-
118
- context "without configured? method" do
119
- klass = Class.new(ErrbitPlugin::IssueTracker) do
120
- def self.label; 'foo'; end
121
- def self.note; 'foo'; end
122
- def self.fields; ['foo']; end
123
- def self.icons; {}; end
124
- def errors; true; end
125
- def create_issue; 'http'; end
126
- def close_issue; 'http'; end
127
- def url; 'http'; end
128
- end
129
-
130
- it 'not valid' do
131
- expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
132
- end
133
-
134
- it 'say not implement configured? method' do
135
- is = ErrbitPlugin::ValidateIssueTracker.new(klass)
136
- is.valid?
137
- expect(is.errors).to eql [[:instance_method_missing, :configured?]]
138
- end
139
- end
140
-
141
- context "without errors method" do
142
- klass = Class.new(ErrbitPlugin::IssueTracker) do
143
- def self.label; 'foo'; end
144
- def self.note; 'foo'; end
145
- def self.fields; ['foo']; end
146
- def self.icons; {}; end
147
- def configured?; true; end
148
- def create_issue; 'http'; end
149
- def close_issue; 'http'; end
150
- def url; 'http'; end
151
- end
152
-
153
- it 'not valid' do
154
- expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
155
- end
156
-
157
- it 'say not implement errors method' do
158
- is = ErrbitPlugin::ValidateIssueTracker.new(klass)
159
- is.valid?
160
- expect(is.errors).to eql [[:instance_method_missing, :errors]]
161
- end
162
- end
163
-
164
- context "without create_issue method" do
165
- klass = Class.new(ErrbitPlugin::IssueTracker) do
166
- def self.label; 'foo'; end
167
- def self.note; 'foo'; end
168
- def self.fields; ['foo']; end
169
- def self.icons; {}; end
170
- def configured?; true; end
171
- def errors; true; end
172
- def close_issue; 'http'; end
173
- def url; 'http'; end
174
- end
175
-
176
- it 'not valid' do
177
- expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
178
- end
179
- it 'say not implement create_issue method' do
180
- is = ErrbitPlugin::ValidateIssueTracker.new(klass)
181
- is.valid?
182
- expect(is.errors).to eql [[:instance_method_missing, :create_issue]]
183
- end
184
- end
185
-
186
- context "without close_issue method" do
187
- # this is an optional method
188
- klass = Class.new(ErrbitPlugin::IssueTracker) do
189
- def self.label; 'foo'; end
190
- def self.note; 'foo'; end
191
- def self.fields; ['foo']; end
192
- def self.icons; {}; end
193
- def configured?; true; end
194
- def errors; true; end
195
- def create_issue; 'http'; end
196
- def url; 'http'; end
197
- end
198
-
199
- it 'is valid' do
200
- expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be true
201
- end
202
- it 'not say not implement close_issue method' do
203
- is = ErrbitPlugin::ValidateIssueTracker.new(klass)
204
- is.valid?
205
- expect(is.errors).not_to eql [[:instance_method_missing, :close_issue]]
206
- end
207
- end
208
-
209
- context "without url method" do
210
- klass = Class.new(ErrbitPlugin::IssueTracker) do
211
- def self.label; 'foo'; end
212
- def self.note; 'foo'; end
213
- def self.fields; ['foo']; end
214
- def self.icons; {}; end
215
- def configured?; true; end
216
- def errors; true; end
217
- def create_issue; 'http'; end
218
- def close_issue; 'http'; end
219
- end
220
-
221
- it 'not valid' do
222
- expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
223
- end
224
-
225
- it 'say not implement url method' do
226
- is = ErrbitPlugin::ValidateIssueTracker.new(klass)
227
- is.valid?
228
- expect(is.errors).to eql [[:instance_method_missing, :url]]
229
- end
230
- end
231
-
232
- context "without note method" do
233
- klass = Class.new(ErrbitPlugin::IssueTracker) do
234
- def self.label; 'foo'; end
235
- def self.fields; ['foo']; end
236
- def self.icons; {}; end
237
- def configured?; true; end
238
- def errors; true; end
239
- def create_issue; 'http'; end
240
- def close_issue; 'http'; end
241
- def url; 'foo'; end
242
- end
243
-
244
- it 'not valid' do
245
- expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
246
- end
247
-
248
- it 'say not implement note method' do
249
- is = ErrbitPlugin::ValidateIssueTracker.new(klass)
250
- is.valid?
251
- expect(is.errors).to eql [[:class_method_missing, :note]]
252
- end
253
- end
254
- end
255
- end