Commit 95197da59e1cb32a971f4dbbb85bda52d07ac8bc
1 parent
84e406c8
Exists in
master
and in
1 other branch
Dont use fake issue tracker from errbit_plugin gem
Fake issue tracker is a mock tracker for tests only, it should live in errbit core
Showing
3 changed files
with
50 additions
and
3 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,48 @@ |
| 1 | +module ErrbitPlugin | |
| 2 | + class MockIssueTracker < IssueTracker | |
| 3 | + def self.label | |
| 4 | + 'mock' | |
| 5 | + end | |
| 6 | + | |
| 7 | + def self.note | |
| 8 | + 'A fake issue tracker to help in testing purpose' | |
| 9 | + end | |
| 10 | + | |
| 11 | + def self.fields | |
| 12 | + { | |
| 13 | + :foo => {:label => 'foo'}, | |
| 14 | + :bar => {:label => 'bar'} | |
| 15 | + } | |
| 16 | + end | |
| 17 | + | |
| 18 | + attr_accessor :output | |
| 19 | + | |
| 20 | + def initialize(*) | |
| 21 | + super | |
| 22 | + @output = [] | |
| 23 | + end | |
| 24 | + | |
| 25 | + def configured? | |
| 26 | + !errors.any? | |
| 27 | + end | |
| 28 | + | |
| 29 | + def errors | |
| 30 | + errors = {} | |
| 31 | + errors[:foo] = 'foo is required' unless options[:foo] | |
| 32 | + errors[:bar] = 'bar is required' unless options[:bar] | |
| 33 | + | |
| 34 | + errors | |
| 35 | + end | |
| 36 | + | |
| 37 | + def create_issue(title, body, user) | |
| 38 | + @output << [title, body, user] | |
| 39 | + true | |
| 40 | + end | |
| 41 | + | |
| 42 | + def url; ''; end | |
| 43 | + | |
| 44 | + def comments_allowed?; false; end | |
| 45 | + end | |
| 46 | +end | |
| 47 | + | |
| 48 | +ErrbitPlugin::Registry.add_issue_tracker(ErrbitPlugin::MockIssueTracker) | ... | ... |
spec/fabricators/issue_tracker_fabricator.rb
spec/spec_helper.rb
| ... | ... | @@ -25,8 +25,7 @@ require 'webmock/rspec' |
| 25 | 25 | require 'xmpp4r' |
| 26 | 26 | require 'xmpp4r/muc' |
| 27 | 27 | require 'mongoid-rspec' |
| 28 | -require 'errbit_plugin/issue_trackers/fake' | |
| 29 | - | |
| 28 | +require 'errbit_plugin/mock_issue_tracker' | |
| 30 | 29 | |
| 31 | 30 | # Requires supporting files with custom matchers and macros, etc, |
| 32 | 31 | # in ./support/ and its subdirectories. | ... | ... |