errbit_plugin 0.7.0 → 0.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96de0d86cf362246fc3ed4690b716f610f46eb542c0ce98dd2cc813a8b370b2e
4
- data.tar.gz: 71d3e197f58dd6537d52df07c57eae866492d8d8f5c7323c4124bcfb1122e0bf
3
+ metadata.gz: c5d3bdf7d5dc59bf8a59721802488f859c956892cb1763f7d2958be6aa753a8f
4
+ data.tar.gz: 34bf05aba892110c124d2aea3d6e8807c36c21fe14037a7f1a61e6e48aa936aa
5
5
  SHA512:
6
- metadata.gz: a50faed1baafbd6c339cab5fab07464fc6be5e6a1e9c3db9a8956531a5546c75390f015304712bf534422a9d817cc5e28fae2c7841f9a7497f53804f376b7170
7
- data.tar.gz: f63f901227633ed315fbd9025e022970250b85e65b9fff3cb25ba639f5a6f17c11c792ad098a1dbf8681f11d3de996c47dc80facc78011504e372ff82b075978
6
+ metadata.gz: c5a36c6b08ae920dc2b13515ed1fa7d69ed44a3e1edbdb766954da0b728b3bd4f9ddb184fa078fe8d481ed31b66d138b62253ab6126b49864eafb6dd0c28500d
7
+ data.tar.gz: caa502d7596676de1641139734549b612f3b391e381bfcb9d7ca3638c0b2196c506ab68445625400162e6c3ea314558873bfb38564176b3aa4ab0ea93d15055f
data/.rubocop.yml CHANGED
@@ -1,13 +1,11 @@
1
- require:
2
- - rubocop-disable_syntax
3
-
4
1
  plugins:
5
2
  - rubocop-performance
6
3
  - rubocop-rake
7
4
  - rubocop-rspec
5
+ - rubocop-disable_syntax
8
6
 
9
7
  AllCops:
10
- TargetRubyVersion: 3.1
8
+ TargetRubyVersion: 4.0
11
9
  NewCops: enable
12
10
 
13
11
  # We use standard as a linter and formatter instead Rubocop.
@@ -346,6 +344,18 @@ RSpec/IndexedLet:
346
344
  RSpec/NamedSubject:
347
345
  Enabled: false
348
346
 
347
+ # Ignore example length
348
+ RSpec/ExampleLength:
349
+ Enabled: false
350
+
351
+ # Ignore maximum example group nesting
352
+ RSpec/NestedGroups:
353
+ Enabled: false
354
+
355
+ # Ignore subject after let declarations
356
+ RSpec/LeadingSubject:
357
+ Enabled: false
358
+
349
359
  # Naming rules:
350
360
 
351
361
  # Disable anonymous block forwarding.
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.7
1
+ 4.0.5
data/.standard.yml CHANGED
@@ -1 +1 @@
1
- ruby_version: 3.1
1
+ ruby_version: 4.0
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # ErrbitPlugin
2
2
 
3
3
  [![RSpec](https://github.com/errbit/errbit_plugin/actions/workflows/rspec.yml/badge.svg)](https://github.com/errbit/errbit_plugin/actions/workflows/rspec.yml)
4
- [![RSpec on JRuby](https://github.com/errbit/errbit_plugin/actions/workflows/jruby.yml/badge.svg)](https://github.com/errbit/errbit_plugin/actions/workflows/jruby.yml)
5
4
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/standardrb/standard)
6
5
 
7
6
  ErrbitPlugin provides a set of base classes that you can extend to create
@@ -9,8 +8,8 @@ Errbit plugins.
9
8
 
10
9
  ## Creating plugins
11
10
 
12
- ErrbitPlugins are Ruby gems that extend the functionality of Errbit. To get
13
- started, create a Ruby gem and add 'errbit_plugin' as a dependency in your
11
+ Errbit plugins are Ruby gems that extend the functionality of Errbit. To get
12
+ started, create a Ruby gem and add `errbit_plugin` as a dependency in your
14
13
  gem's gemspec.
15
14
 
16
15
  Now you can start adding plugins. At the moment, there is only one kind of
@@ -19,32 +18,32 @@ plugin you can create, and that is the issue tracker.
19
18
  ### Issue Trackers
20
19
 
21
20
  An issue tracker plugin is a Ruby class that enables you to link errors within
22
- errbit to an issue in an external issue tracker like Github. An app within
23
- errbit can be associated an issue tracker or not. When there is an association,
24
- errbit users can choose 'create issue' from an error page which will both
25
- create an issue on the external issue tracker out of the given error and link
26
- that issue to the errbit error. Likewise, a user can also choose 'close issue'
27
- to close the issue on the external issue tracker, if your plugin provides a
28
- method to do so.
21
+ Errbit to an issue in an external issue tracker like GitHub. An app within
22
+ Errbit can be associated with an issue tracker or not. When there is an
23
+ association, Errbit users can choose 'create issue' from an error page which
24
+ will both create an issue on the external issue tracker out of the given
25
+ error and link that issue to the Errbit error. Likewise, a user can also
26
+ choose 'close issue' to close the issue on the external issue tracker, if your
27
+ plugin provides a method to do so.
29
28
 
30
29
  Your issue tracker plugin is responsible for providing the interface defined by
31
- ErrbitPlugin::IssueTracker. All of the required methods must be implemented and
32
- the class must extend ErrbitPlugin::IssueTracker. Here's an example:
30
+ `ErrbitPlugin::IssueTracker`. All the required methods must be implemented and
31
+ the class must extend `ErrbitPlugin::IssueTracker`. Here's an example:
33
32
 
34
33
  ```ruby
35
34
  class MyIssueTracker < ErrbitPlugin::IssueTracker
36
35
 
37
- # A unique label for your tracker plugin used internally by errbit
36
+ # A unique label for your tracker plugin used internally by Errbit
38
37
  def self.label
39
- 'my-tracker'
38
+ "my-tracker"
40
39
  end
41
40
 
42
41
  def self.note
43
- 'a note about this tracker that users will see'
42
+ "a note about this tracker that users will see"
44
43
  end
45
44
 
46
45
  # Form fields that will be presented to the administrator when setting up
47
- # or editing the errbit app. The values we collect will be availble for use
46
+ # or editing the Errbit app. The values we collect will be available for use
48
47
  # later when we have an instance of this class.
49
48
  def self.fields
50
49
  {
@@ -64,14 +63,14 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker
64
63
  # and the binary icon data.
65
64
  def self.icons
66
65
  @icons ||= {
67
- create: [ 'image/png', File.read('./path/to/create.png') ],
68
- goto: [ 'image/png', File.read('./path/to/goto.png') ],
69
- inactive: [ 'image/png', File.read('./path/to/inactive.png') ],
66
+ create: [ "image/png", File.read("./path/to/create.png") ],
67
+ goto: [ "image/png", File.read("./path/to/goto.png") ],
68
+ inactive: [ "image/png", File.read("./path/to/inactive.png") ],
70
69
  }
71
70
  end
72
71
 
73
72
  # If this tracker can be in a configured or non-configured state, you can let
74
- # errbit know by returning a Boolean here
73
+ # Errbit know by returning a Boolean here
75
74
  def configured?
76
75
  # In this case, we'll say this issue tracker is configured when username
77
76
  # and password are set
@@ -84,7 +83,7 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker
84
83
  if options[:username]
85
84
  {}
86
85
  else
87
- { field_one: 'username must be present' }
86
+ { field_one: "username must be present" }
88
87
  end
89
88
  end
90
89
 
@@ -96,7 +95,7 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker
96
95
  def create_issue(title, body, user: {})
97
96
  # Create an issue! Then update the problem to link it.
98
97
 
99
- 'http://sometracker.com/my/issue/123'
98
+ "https://sometracker.com/my/issue/123"
100
99
  end
101
100
 
102
101
  # This method is optional. Errbit will create body text for your issue by
@@ -108,10 +107,10 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker
108
107
  # If you don't implement this method, Errbit will render a body using a
109
108
  # default template
110
109
  #
111
- # @see http://apidock.com/rails/ActionController/Base/render_to_string
110
+ # @see https://apidock.com/rails/ActionController/Base/render_to_string
112
111
  def render_body_args
113
112
  # In this example, we want to render a special file
114
- ['/path/to/some/template', formats: [:rdoc]]
113
+ ["/path/to/some/template", formats: [:rdoc]]
115
114
  end
116
115
 
117
116
  # This method is optional, and is where you actually go close the issue on
@@ -125,7 +124,7 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker
125
124
 
126
125
  # The URL for your remote issue tracker
127
126
  def url
128
- 'http://some-remote-tracker.com'
127
+ "https://some-remote-tracker.com"
129
128
  end
130
129
  end
131
130
  ```
@@ -133,4 +132,4 @@ end
133
132
  ## Contributing
134
133
 
135
134
  Discuss any changes you'd like to make with the authors on the mailing list, or
136
- by opening a github issue.
135
+ by opening a GitHub issue.
@@ -37,7 +37,7 @@ module ErrbitPlugin
37
37
  end
38
38
  end
39
39
 
40
- impl.all? { |value| value == true }
40
+ impl.all?(true)
41
41
  end
42
42
 
43
43
  def implements_class_methods?
@@ -50,7 +50,7 @@ module ErrbitPlugin
50
50
  end
51
51
  end
52
52
 
53
- impl.all? { |value| value == true }
53
+ impl.all?(true)
54
54
  end
55
55
 
56
56
  def instance
@@ -44,11 +44,11 @@ module ErrbitPlugin
44
44
  ""
45
45
  end
46
46
 
47
- def create_issue(*)
47
+ def create_issue(*) # rubocop:disable Naming/PredicateMethod
48
48
  false
49
49
  end
50
50
 
51
- def close_issue(*)
51
+ def close_issue(*) # rubocop:disable Naming/PredicateMethod
52
52
  false
53
53
  end
54
54
  end
@@ -11,7 +11,7 @@ module ErrbitPlugin
11
11
  def self.add_issue_tracker(klass)
12
12
  key = klass.label
13
13
 
14
- if issue_trackers.has_key?(key)
14
+ if issue_trackers.key?(key)
15
15
  raise AlreadyRegisteredError,
16
16
  "issue_tracker '#{key}' already registered"
17
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ErrbitPlugin
4
- VERSION = "0.7.0"
4
+ VERSION = "0.8.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: errbit_plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Crosby
@@ -16,31 +16,20 @@ executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
- - ".envrc"
20
- - ".github/workflows/jruby.yml"
21
- - ".github/workflows/rspec.yml"
22
- - ".gitignore"
23
19
  - ".rspec"
24
20
  - ".rubocop.yml"
25
21
  - ".ruby-version"
26
22
  - ".standard.yml"
27
- - Gemfile
28
- - Gemfile.lock
29
23
  - LICENSE
30
24
  - LICENSE.txt
31
25
  - README.md
32
26
  - Rakefile
33
- - errbit_plugin.gemspec
34
27
  - lib/errbit_plugin.rb
35
28
  - lib/errbit_plugin/issue_tracker.rb
36
29
  - lib/errbit_plugin/issue_tracker_validator.rb
37
30
  - lib/errbit_plugin/none_issue_tracker.rb
38
31
  - lib/errbit_plugin/registry.rb
39
32
  - lib/errbit_plugin/version.rb
40
- - spec/errbit_plugin/issue_tracker_validator_spec.rb
41
- - spec/errbit_plugin/none_issue_tracker_spec.rb
42
- - spec/errbit_plugin/registry_spec.rb
43
- - spec/spec_helper.rb
44
33
  - static/fake_create.png
45
34
  - static/fake_inactive.png
46
35
  - static/none_create.png
@@ -60,14 +49,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
49
  requirements:
61
50
  - - ">="
62
51
  - !ruby/object:Gem::Version
63
- version: 3.1.0
52
+ version: 4.0.0
64
53
  required_rubygems_version: !ruby/object:Gem::Requirement
65
54
  requirements:
66
55
  - - ">="
67
56
  - !ruby/object:Gem::Version
68
57
  version: '0'
69
58
  requirements: []
70
- rubygems_version: 3.6.7
59
+ rubygems_version: 4.0.13
71
60
  specification_version: 4
72
61
  summary: Base to create an errbit plugin
73
62
  test_files: []
data/.envrc DELETED
@@ -1 +0,0 @@
1
- export JRUBY_OPTS="--debug"
@@ -1,37 +0,0 @@
1
- name: RSpec on JRuby
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
- pull_request:
8
- branches:
9
- - master
10
- schedule:
11
- - cron: "0 21 * * 6"
12
-
13
- env:
14
- JRUBY_OPTS: "--debug"
15
-
16
- jobs:
17
- rspec:
18
- runs-on: ubuntu-24.04
19
- timeout-minutes: 10
20
- strategy:
21
- fail-fast: false
22
- matrix:
23
- ruby: ["jruby-9.4", "jruby-head"]
24
-
25
- steps:
26
- - uses: actions/checkout@v4
27
- - run: rm -f Gemfile.lock
28
- - run: rm -f .ruby-version
29
- - name: Set up Ruby
30
- uses: ruby/setup-ruby@v1
31
- with:
32
- ruby-version: ${{ matrix.ruby }}
33
- rubygems: latest
34
- bundler: latest
35
- bundler-cache: true
36
-
37
- - run: bundle exec rspec
@@ -1,35 +0,0 @@
1
-
2
- name: RSpec
3
-
4
- on:
5
- push:
6
- branches:
7
- - master
8
- pull_request:
9
- branches:
10
- - master
11
- schedule:
12
- - cron: "0 21 * * 6"
13
-
14
- jobs:
15
- rspec:
16
- runs-on: ubuntu-24.04
17
- timeout-minutes: 10
18
- strategy:
19
- fail-fast: false
20
- matrix:
21
- ruby: ["3.1", "3.2", "3.3", "3.4"]
22
-
23
- steps:
24
- - uses: actions/checkout@v4
25
- - run: rm -f Gemfile.lock
26
- - run: rm -f .ruby-version
27
- - name: Set up Ruby
28
- uses: ruby/setup-ruby@v1
29
- with:
30
- ruby-version: ${{ matrix.ruby }}
31
- rubygems: latest
32
- bundler: latest
33
- bundler-cache: true
34
-
35
- - run: bundle exec rspec
data/.gitignore DELETED
@@ -1,23 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- InstalledFiles
7
- _yardoc
8
- coverage
9
- doc/
10
- lib/bundler/man
11
- pkg
12
- rdoc
13
- spec/reports
14
- test/tmp
15
- test/version_tmp
16
- tmp
17
-
18
- # YARD artifacts
19
- .yardoc
20
- _yardoc
21
- doc/
22
- .idea
23
- .rspec_status
data/Gemfile DELETED
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- # Specify your gem's dependencies in errbit_plugin.gemspec
6
- gemspec
7
-
8
- gem "rake"
9
- gem "rspec"
10
- gem "simplecov", require: false
11
- gem "standard", require: false
12
- gem "rubocop", require: false
13
- gem "rubocop-disable_syntax", require: false
14
- gem "rubocop-performance", require: false
15
- gem "rubocop-rake", require: false
16
- gem "rubocop-rspec", require: false
data/Gemfile.lock DELETED
@@ -1,102 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- errbit_plugin (0.7.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- ast (2.4.3)
10
- diff-lcs (1.6.1)
11
- docile (1.4.1)
12
- json (2.10.2)
13
- language_server-protocol (3.17.0.4)
14
- lint_roller (1.1.0)
15
- parallel (1.26.3)
16
- parser (3.3.7.4)
17
- ast (~> 2.4.1)
18
- racc
19
- prism (1.4.0)
20
- racc (1.8.1)
21
- rainbow (3.1.1)
22
- rake (13.2.1)
23
- regexp_parser (2.10.0)
24
- rspec (3.13.0)
25
- rspec-core (~> 3.13.0)
26
- rspec-expectations (~> 3.13.0)
27
- rspec-mocks (~> 3.13.0)
28
- rspec-core (3.13.3)
29
- rspec-support (~> 3.13.0)
30
- rspec-expectations (3.13.3)
31
- diff-lcs (>= 1.2.0, < 2.0)
32
- rspec-support (~> 3.13.0)
33
- rspec-mocks (3.13.2)
34
- diff-lcs (>= 1.2.0, < 2.0)
35
- rspec-support (~> 3.13.0)
36
- rspec-support (3.13.2)
37
- rubocop (1.75.2)
38
- json (~> 2.3)
39
- language_server-protocol (~> 3.17.0.2)
40
- lint_roller (~> 1.1.0)
41
- parallel (~> 1.10)
42
- parser (>= 3.3.0.2)
43
- rainbow (>= 2.2.2, < 4.0)
44
- regexp_parser (>= 2.9.3, < 3.0)
45
- rubocop-ast (>= 1.44.0, < 2.0)
46
- ruby-progressbar (~> 1.7)
47
- unicode-display_width (>= 2.4.0, < 4.0)
48
- rubocop-ast (1.44.1)
49
- parser (>= 3.3.7.2)
50
- prism (~> 1.4)
51
- rubocop-disable_syntax (0.1.1)
52
- rubocop (>= 1.50)
53
- rubocop-performance (1.25.0)
54
- lint_roller (~> 1.1)
55
- rubocop (>= 1.75.0, < 2.0)
56
- rubocop-ast (>= 1.38.0, < 2.0)
57
- rubocop-rake (0.7.1)
58
- lint_roller (~> 1.1)
59
- rubocop (>= 1.72.1)
60
- rubocop-rspec (3.5.0)
61
- lint_roller (~> 1.1)
62
- rubocop (~> 1.72, >= 1.72.1)
63
- ruby-progressbar (1.13.0)
64
- simplecov (0.22.0)
65
- docile (~> 1.1)
66
- simplecov-html (~> 0.11)
67
- simplecov_json_formatter (~> 0.1)
68
- simplecov-html (0.13.1)
69
- simplecov_json_formatter (0.1.4)
70
- standard (1.49.0)
71
- language_server-protocol (~> 3.17.0.2)
72
- lint_roller (~> 1.0)
73
- rubocop (~> 1.75.2)
74
- standard-custom (~> 1.0.0)
75
- standard-performance (~> 1.8)
76
- standard-custom (1.0.2)
77
- lint_roller (~> 1.0)
78
- rubocop (~> 1.50)
79
- standard-performance (1.8.0)
80
- lint_roller (~> 1.1)
81
- rubocop-performance (~> 1.25.0)
82
- unicode-display_width (3.1.4)
83
- unicode-emoji (~> 4.0, >= 4.0.4)
84
- unicode-emoji (4.0.4)
85
-
86
- PLATFORMS
87
- arm64-darwin-24
88
-
89
- DEPENDENCIES
90
- errbit_plugin!
91
- rake
92
- rspec
93
- rubocop
94
- rubocop-disable_syntax
95
- rubocop-performance
96
- rubocop-rake
97
- rubocop-rspec
98
- simplecov
99
- standard
100
-
101
- BUNDLED WITH
102
- 2.6.7
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/errbit_plugin/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "errbit_plugin"
7
- spec.version = ErrbitPlugin::VERSION
8
- spec.authors = ["Stephen Crosby"]
9
- spec.email = ["stevecrozz@gmail.com"]
10
-
11
- spec.summary = "Base to create an errbit plugin"
12
- spec.description = "Base to create an errbit plugin"
13
- spec.homepage = "https://github.com/errbit/errbit_plugin"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 3.1.0"
16
-
17
- spec.metadata["homepage_uri"] = spec.homepage
18
- spec.metadata["source_code_uri"] = spec.homepage
19
- spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
20
- spec.metadata["rubygems_mfa_required"] = "true"
21
-
22
- spec.files = `git ls-files`.split($/)
23
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
24
- spec.require_paths = ["lib"]
25
- end
@@ -1,517 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe ErrbitPlugin::IssueTrackerValidator do
6
- describe "#valid?" do
7
- context "with a complete class" do
8
- klass = Class.new(ErrbitPlugin::IssueTracker) do
9
- def self.label
10
- "foo"
11
- end
12
-
13
- def self.note
14
- "foo"
15
- end
16
-
17
- def self.fields
18
- ["foo"]
19
- end
20
-
21
- def self.icons
22
- {}
23
- end
24
-
25
- def configured?
26
- true
27
- end
28
-
29
- def errors
30
- true
31
- end
32
-
33
- def create_issue
34
- "http"
35
- end
36
-
37
- def close_issue
38
- "http"
39
- end
40
-
41
- def url
42
- "http"
43
- end
44
- end
45
-
46
- it "valid" do
47
- expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be true
48
- end
49
- end
50
-
51
- context "with class not inherit from ErrbitPlugin::IssueTracker" do
52
- klass = Class.new do
53
- def self.label
54
- "foo"
55
- end
56
-
57
- def self.note
58
- "foo"
59
- end
60
-
61
- def self.fields
62
- ["foo"]
63
- end
64
-
65
- def self.icons
66
- {}
67
- end
68
-
69
- def initialize(params)
70
- end
71
-
72
- def configured?
73
- true
74
- end
75
-
76
- def errors
77
- true
78
- end
79
-
80
- def create_issue
81
- "http"
82
- end
83
-
84
- def close_issue
85
- "http"
86
- end
87
-
88
- def url
89
- "http"
90
- end
91
- end
92
-
93
- it "not valid" do
94
- expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false
95
- end
96
-
97
- it "says :not_inherited" do
98
- is = ErrbitPlugin::IssueTrackerValidator.new(klass)
99
- is.valid?
100
- expect(is.errors).to eql [[:not_inherited]]
101
- end
102
- end
103
-
104
- context "with no label method" do
105
- klass = Class.new(ErrbitPlugin::IssueTracker) do
106
- def self.note
107
- "foo"
108
- end
109
-
110
- def self.fields
111
- ["foo"]
112
- end
113
-
114
- def self.icons
115
- {}
116
- end
117
-
118
- def configured?
119
- true
120
- end
121
-
122
- def errors
123
- true
124
- end
125
-
126
- def create_issue
127
- "http"
128
- end
129
-
130
- def close_issue
131
- "http"
132
- end
133
-
134
- def url
135
- "http"
136
- end
137
- end
138
-
139
- it "not valid" do
140
- expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false
141
- end
142
-
143
- it "say not implement label method" do
144
- is = ErrbitPlugin::IssueTrackerValidator.new(klass)
145
- is.valid?
146
- expect(is.errors).to eql [[:class_method_missing, :label]]
147
- end
148
- end
149
-
150
- context "with no icons method" do
151
- klass = Class.new(ErrbitPlugin::IssueTracker) do
152
- def self.note
153
- "foo"
154
- end
155
-
156
- def self.fields
157
- ["foo"]
158
- end
159
-
160
- def self.label
161
- "alabel"
162
- end
163
-
164
- def configured?
165
- true
166
- end
167
-
168
- def errors
169
- true
170
- end
171
-
172
- def create_issue
173
- "http"
174
- end
175
-
176
- def close_issue
177
- "http"
178
- end
179
-
180
- def url
181
- "http"
182
- end
183
- end
184
-
185
- it "not valid" do
186
- expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false
187
- end
188
-
189
- it "say not implement icons method" do
190
- is = ErrbitPlugin::IssueTrackerValidator.new(klass)
191
- is.valid?
192
- expect(is.errors).to eql [[:class_method_missing, :icons]]
193
- end
194
- end
195
-
196
- context "without fields method" do
197
- klass = Class.new(ErrbitPlugin::IssueTracker) do
198
- def self.label
199
- "foo"
200
- end
201
-
202
- def self.note
203
- "foo"
204
- end
205
-
206
- def self.icons
207
- {}
208
- end
209
-
210
- def configured?
211
- true
212
- end
213
-
214
- def errors
215
- true
216
- end
217
-
218
- def create_issue
219
- "http"
220
- end
221
-
222
- def close_issue
223
- "http"
224
- end
225
-
226
- def url
227
- "http"
228
- end
229
- end
230
-
231
- it "not valid" do
232
- expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false
233
- end
234
-
235
- it "say not implement fields method" do
236
- is = ErrbitPlugin::IssueTrackerValidator.new(klass)
237
- is.valid?
238
- expect(is.errors).to eql [[:class_method_missing, :fields]]
239
- end
240
- end
241
-
242
- context "without configured? method" do
243
- klass = Class.new(ErrbitPlugin::IssueTracker) do
244
- def self.label
245
- "foo"
246
- end
247
-
248
- def self.note
249
- "foo"
250
- end
251
-
252
- def self.fields
253
- ["foo"]
254
- end
255
-
256
- def self.icons
257
- {}
258
- end
259
-
260
- def errors
261
- true
262
- end
263
-
264
- def create_issue
265
- "http"
266
- end
267
-
268
- def close_issue
269
- "http"
270
- end
271
-
272
- def url
273
- "http"
274
- end
275
- end
276
-
277
- it "not valid" do
278
- expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false
279
- end
280
-
281
- it "say not implement configured? method" do
282
- is = ErrbitPlugin::IssueTrackerValidator.new(klass)
283
- is.valid?
284
- expect(is.errors).to eql [[:instance_method_missing, :configured?]]
285
- end
286
- end
287
-
288
- context "without errors method" do
289
- klass = Class.new(ErrbitPlugin::IssueTracker) do
290
- def self.label
291
- "foo"
292
- end
293
-
294
- def self.note
295
- "foo"
296
- end
297
-
298
- def self.fields
299
- ["foo"]
300
- end
301
-
302
- def self.icons
303
- {}
304
- end
305
-
306
- def configured?
307
- true
308
- end
309
-
310
- def create_issue
311
- "http"
312
- end
313
-
314
- def close_issue
315
- "http"
316
- end
317
-
318
- def url
319
- "http"
320
- end
321
- end
322
-
323
- it "not valid" do
324
- expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false
325
- end
326
-
327
- it "say not implement errors method" do
328
- is = ErrbitPlugin::IssueTrackerValidator.new(klass)
329
- is.valid?
330
- expect(is.errors).to eql [[:instance_method_missing, :errors]]
331
- end
332
- end
333
-
334
- context "without create_issue method" do
335
- klass = Class.new(ErrbitPlugin::IssueTracker) do
336
- def self.label
337
- "foo"
338
- end
339
-
340
- def self.note
341
- "foo"
342
- end
343
-
344
- def self.fields
345
- ["foo"]
346
- end
347
-
348
- def self.icons
349
- {}
350
- end
351
-
352
- def configured?
353
- true
354
- end
355
-
356
- def errors
357
- true
358
- end
359
-
360
- def close_issue
361
- "http"
362
- end
363
-
364
- def url
365
- "http"
366
- end
367
- end
368
-
369
- it "not valid" do
370
- expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false
371
- end
372
- it "say not implement create_issue method" do
373
- is = ErrbitPlugin::IssueTrackerValidator.new(klass)
374
- is.valid?
375
- expect(is.errors).to eql [[:instance_method_missing, :create_issue]]
376
- end
377
- end
378
-
379
- context "without close_issue method" do
380
- # this is an optional method
381
- klass = Class.new(ErrbitPlugin::IssueTracker) do
382
- def self.label
383
- "foo"
384
- end
385
-
386
- def self.note
387
- "foo"
388
- end
389
-
390
- def self.fields
391
- ["foo"]
392
- end
393
-
394
- def self.icons
395
- {}
396
- end
397
-
398
- def configured?
399
- true
400
- end
401
-
402
- def errors
403
- true
404
- end
405
-
406
- def create_issue
407
- "http"
408
- end
409
-
410
- def url
411
- "http"
412
- end
413
- end
414
-
415
- it "is valid" do
416
- expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be true
417
- end
418
- it "not say not implement close_issue method" do
419
- is = ErrbitPlugin::IssueTrackerValidator.new(klass)
420
- is.valid?
421
- expect(is.errors).not_to eql [[:instance_method_missing, :close_issue]]
422
- end
423
- end
424
-
425
- context "without url method" do
426
- klass = Class.new(ErrbitPlugin::IssueTracker) do
427
- def self.label
428
- "foo"
429
- end
430
-
431
- def self.note
432
- "foo"
433
- end
434
-
435
- def self.fields
436
- ["foo"]
437
- end
438
-
439
- def self.icons
440
- {}
441
- end
442
-
443
- def configured?
444
- true
445
- end
446
-
447
- def errors
448
- true
449
- end
450
-
451
- def create_issue
452
- "http"
453
- end
454
-
455
- def close_issue
456
- "http"
457
- end
458
- end
459
-
460
- it "not valid" do
461
- expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false
462
- end
463
-
464
- it "say not implement url method" do
465
- is = ErrbitPlugin::IssueTrackerValidator.new(klass)
466
- is.valid?
467
- expect(is.errors).to eql [[:instance_method_missing, :url]]
468
- end
469
- end
470
-
471
- context "without note method" do
472
- klass = Class.new(ErrbitPlugin::IssueTracker) do
473
- def self.label
474
- "foo"
475
- end
476
-
477
- def self.fields
478
- ["foo"]
479
- end
480
-
481
- def self.icons
482
- {}
483
- end
484
-
485
- def configured?
486
- true
487
- end
488
-
489
- def errors
490
- true
491
- end
492
-
493
- def create_issue
494
- "http"
495
- end
496
-
497
- def close_issue
498
- "http"
499
- end
500
-
501
- def url
502
- "foo"
503
- end
504
- end
505
-
506
- it "not valid" do
507
- expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false
508
- end
509
-
510
- it "say not implement note method" do
511
- is = ErrbitPlugin::IssueTrackerValidator.new(klass)
512
- is.valid?
513
- expect(is.errors).to eql [[:class_method_missing, :note]]
514
- end
515
- end
516
- end
517
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe ErrbitPlugin::NoneIssueTracker do
6
- let(:options) { {} }
7
-
8
- subject { described_class.new(options) }
9
-
10
- it { expect(subject).to be_an(ErrbitPlugin::IssueTracker) }
11
-
12
- it { expect(subject.configured?).to eq(false) }
13
-
14
- it { expect(subject.errors).to eq({}) }
15
-
16
- it { expect(subject.url).to eq("") }
17
-
18
- it { expect(subject.create_issue).to eq(false) }
19
-
20
- it { expect(subject.close_issue).to eq(false) }
21
-
22
- it { expect(described_class.label).to eq("none") }
23
-
24
- it { expect(described_class.note).to start_with("When no issue tracker") }
25
-
26
- it { expect(described_class.fields).to eq({}) }
27
-
28
- it { expect(described_class.icons).not_to be_empty }
29
-
30
- # TODO: .read_static_file
31
- end
@@ -1,68 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe ErrbitPlugin::Registry do
6
- before do
7
- ErrbitPlugin::Registry.clear_issue_trackers
8
- end
9
-
10
- let(:tracker) {
11
- tracker = Class.new(ErrbitPlugin::IssueTracker) do
12
- def self.label
13
- "something"
14
- end
15
- end
16
- tracker
17
- }
18
-
19
- describe ".add_issue_tracker" do
20
- context "with issue_tracker class valid" do
21
- before do
22
- allow(ErrbitPlugin::IssueTrackerValidator)
23
- .to receive(:new)
24
- .with(tracker)
25
- .and_return(double(valid?: true, message: ""))
26
- end
27
- it "add new issue_tracker plugin" do
28
- ErrbitPlugin::Registry.add_issue_tracker(tracker)
29
- expect(ErrbitPlugin::Registry.issue_trackers).to eq({
30
- "something" => tracker
31
- })
32
- end
33
- context "with already issue_tracker with this key" do
34
- it "raise ErrbitPlugin::AlreadyRegisteredError" do
35
- ErrbitPlugin::Registry.add_issue_tracker(tracker)
36
- expect {
37
- ErrbitPlugin::Registry.add_issue_tracker(tracker)
38
- }.to raise_error(ErrbitPlugin::AlreadyRegisteredError)
39
- end
40
- end
41
- end
42
-
43
- context "with an IssueTracker not valid" do
44
- it "raise an IncompatibilityError" do
45
- allow(ErrbitPlugin::IssueTrackerValidator)
46
- .to receive(:new)
47
- .with(tracker)
48
- .and_return(double(valid?: false, message: "foo", errors: []))
49
- expect {
50
- ErrbitPlugin::Registry.add_issue_tracker(tracker)
51
- }.to raise_error(ErrbitPlugin::IncompatibilityError)
52
- end
53
-
54
- it "puts the errors in the exception message" do
55
- allow(ErrbitPlugin::IssueTrackerValidator)
56
- .to receive(:new)
57
- .with(tracker)
58
- .and_return(double(valid?: false, message: "foo", errors: ["one", "two"]))
59
-
60
- begin
61
- ErrbitPlugin::Registry.add_issue_tracker(tracker)
62
- rescue ErrbitPlugin::IncompatibilityError => e
63
- expect(e.message).to eq("one; two")
64
- end
65
- end
66
- end
67
- end
68
- end
data/spec/spec_helper.rb DELETED
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "simplecov"
4
-
5
- SimpleCov.start do
6
- enable_coverage :branch
7
-
8
- primary_coverage :branch
9
-
10
- add_filter "spec/"
11
- end
12
-
13
- require "errbit_plugin"
14
-
15
- RSpec.configure do |config|
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
25
- end