diff --git a/spec/controllers/problems_controller_spec.rb b/spec/controllers/problems_controller_spec.rb index 968ebe2..5d72144 100644 --- a/spec/controllers/problems_controller_spec.rb +++ b/spec/controllers/problems_controller_spec.rb @@ -275,7 +275,7 @@ describe ProblemsController do end it "should redirect to problem page" do - expect(response).to redirect_to( app_problem_path(problem.app, problem) ) + expect(response).to redirect_to(app_problem_path(problem.app, problem)) expect(flash[:error]).to be_blank end end diff --git a/spec/errbit_plugin/mock_issue_tracker.rb b/spec/errbit_plugin/mock_issue_tracker.rb index 3c2d1f8..66ca36d 100644 --- a/spec/errbit_plugin/mock_issue_tracker.rb +++ b/spec/errbit_plugin/mock_issue_tracker.rb @@ -27,10 +27,9 @@ module ErrbitPlugin end def errors - errors = {} - errors[:foo] = 'foo is required' unless options[:foo] - errors[:bar] = 'bar is required' unless options[:bar] - + errors = [] + errors << [:foo, 'foo is required'] unless options[:foo] + errors << [:bar, 'bar is required'] unless options[:bar] errors end @@ -44,5 +43,3 @@ module ErrbitPlugin def comments_allowed?; false; end end end - -ErrbitPlugin::Registry.add_issue_tracker(ErrbitPlugin::MockIssueTracker) diff --git a/spec/fabricators/issue_tracker_fabricator.rb b/spec/fabricators/issue_tracker_fabricator.rb index 5e2314a..2b6ab82 100644 --- a/spec/fabricators/issue_tracker_fabricator.rb +++ b/spec/fabricators/issue_tracker_fabricator.rb @@ -4,6 +4,5 @@ Fabricator :issue_tracker do :foo => 'one', :bar => 'two' }} - app end diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index a030856..5884264 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -7,6 +7,11 @@ describe Issue do let(:problem) { notice.problem } let(:notice) { Fabricate(:notice) } let(:user) { Fabricate(:admin) } + let(:issue_tracker) do + Fabricate(:issue_tracker).tap do |t| + t.instance_variable_set(:@tracker, ErrbitPlugin::MockIssueTracker.new(t.options)) + end + end context "when app has no issue tracker" do let(:title) { "Foo" } @@ -26,7 +31,6 @@ describe Issue do end context "when has no title" do - let(:tracker) { Fabricate(:issue_tracker) } let(:body) { "barrr" } pending "returns an error" do @@ -34,7 +38,6 @@ describe Issue do end context "when has no body" do - let(:tracker) { Fabricate(:issue_tracker) } let(:title) { "Foo" } pending "returns an error" do @@ -42,7 +45,6 @@ describe Issue do end context "when app has a issue tracker" do - let(:issue_tracker) { Fabricate(:issue_tracker) } let(:title) { "Foo" } let(:body) { "barrr" } diff --git a/spec/models/problem_spec.rb b/spec/models/problem_spec.rb index 4481aea..3b0f134 100644 --- a/spec/models/problem_spec.rb +++ b/spec/models/problem_spec.rb @@ -391,7 +391,9 @@ describe Problem do context "with issue_tracker valid associate to app" do let(:issue_tracker) do - Fabricate(:issue_tracker) + Fabricate(:issue_tracker).tap do |t| + t.instance_variable_set(:@tracker, ErrbitPlugin::MockIssueTracker.new(t.options)) + end end it 'return the issue_tracker label' do diff --git a/spec/views/problems/show.html.haml_spec.rb b/spec/views/problems/show.html.haml_spec.rb index 7ec9a78..a64ff43 100644 --- a/spec/views/problems/show.html.haml_spec.rb +++ b/spec/views/problems/show.html.haml_spec.rb @@ -4,15 +4,13 @@ describe "problems/show.html.haml" do let(:problem) { Fabricate(:problem) } let(:comment) { Fabricate(:comment) } let(:pivotal_tracker) { - Class.new(ErrbitPlugin::IssueTracker) do + Class.new(ErrbitPlugin::MockIssueTracker) do def self.label; 'pivotal'; end - def initialize(options); end def configured?; true; end end } let(:github_tracker) { - Class.new(ErrbitPlugin::IssueTracker) do - def initialize(options); end + Class.new(ErrbitPlugin::MockIssueTracker) do def label; 'github'; end def configured?; true; end end -- libgit2 0.21.2