Commit 5cc81085cee1fca1a8718741ad8606696c4c0bf7
1 parent
02db31b7
Exists in
master
and in
1 other branch
Fix tests
Showing
3 changed files
with
5 additions
and
40 deletions
Show diff stats
spec/controllers/apps_controller_spec.rb
| @@ -308,42 +308,6 @@ describe AppsController do | @@ -308,42 +308,6 @@ describe AppsController do | ||
| 308 | expect(@app.issue_tracker_configured?).to eq false | 308 | expect(@app.issue_tracker_configured?).to eq false |
| 309 | end | 309 | end |
| 310 | end | 310 | end |
| 311 | - | ||
| 312 | - ErrbitPlugin::Registry.issue_trackers.each do |key, klass| | ||
| 313 | - context key do | ||
| 314 | - it "should save tracker params" do | ||
| 315 | - params = { | ||
| 316 | - :options => klass.fields.inject({}){|hash,f| hash[f[0]] = "test_value"; hash }, | ||
| 317 | - :type_tracker => key.dup.to_s | ||
| 318 | - } | ||
| 319 | - put :update, :id => @app.id, :app => {:issue_tracker_attributes => params} | ||
| 320 | - | ||
| 321 | - @app.reload | ||
| 322 | - | ||
| 323 | - tracker = @app.issue_tracker | ||
| 324 | - expect(tracker.tracker).to be_a(ErrbitPlugin::Registry.issue_trackers[key]) | ||
| 325 | - klass.fields.each do |field, field_info| | ||
| 326 | - case field | ||
| 327 | - when :ticket_properties; tracker.send(field.to_sym).should == 'card_type = defect' | ||
| 328 | - else tracker.options[field.to_s].should == 'test_value' | ||
| 329 | - end | ||
| 330 | - end | ||
| 331 | - end | ||
| 332 | - | ||
| 333 | - it "should show validation notice when sufficient params are not present" do | ||
| 334 | - # Leave out one required param | ||
| 335 | - # TODO. previous test was not relevant because one params can be enough. So put noone | ||
| 336 | - put :update, :id => @app.id, :app => { | ||
| 337 | - :issue_tracker_attributes => { | ||
| 338 | - :type_tracker => key.dup.to_s | ||
| 339 | - } | ||
| 340 | - } | ||
| 341 | - | ||
| 342 | - @app.reload | ||
| 343 | - expect(@app.issue_tracker_configured?).to eq false | ||
| 344 | - end | ||
| 345 | - end | ||
| 346 | - end | ||
| 347 | end | 311 | end |
| 348 | end | 312 | end |
| 349 | 313 |
spec/models/problem_spec.rb
| @@ -395,7 +395,7 @@ describe Problem do | @@ -395,7 +395,7 @@ describe Problem do | ||
| 395 | end | 395 | end |
| 396 | 396 | ||
| 397 | it 'return the issue_tracker label' do | 397 | it 'return the issue_tracker label' do |
| 398 | - expect(problem.issue_type).to eql 'fake' | 398 | + expect(problem.issue_type).to eql 'mock' |
| 399 | end | 399 | end |
| 400 | end | 400 | end |
| 401 | 401 |
spec/views/problems/show.html.haml_spec.rb
| @@ -6,13 +6,13 @@ describe "problems/show.html.haml" do | @@ -6,13 +6,13 @@ describe "problems/show.html.haml" do | ||
| 6 | let(:pivotal_tracker) { | 6 | let(:pivotal_tracker) { |
| 7 | Class.new(ErrbitPlugin::IssueTracker) do | 7 | Class.new(ErrbitPlugin::IssueTracker) do |
| 8 | def self.label; 'pivotal'; end | 8 | def self.label; 'pivotal'; end |
| 9 | - def initialize(app, params); end | 9 | + def initialize(options); end |
| 10 | def configured?; true; end | 10 | def configured?; true; end |
| 11 | end | 11 | end |
| 12 | } | 12 | } |
| 13 | let(:github_tracker) { | 13 | let(:github_tracker) { |
| 14 | Class.new(ErrbitPlugin::IssueTracker) do | 14 | Class.new(ErrbitPlugin::IssueTracker) do |
| 15 | - def initialize(app, params); end | 15 | + def initialize(options); end |
| 16 | def label; 'github'; end | 16 | def label; 'github'; end |
| 17 | def configured?; true; end | 17 | def configured?; true; end |
| 18 | end | 18 | end |
| @@ -36,8 +36,9 @@ describe "problems/show.html.haml" do | @@ -36,8 +36,9 @@ describe "problems/show.html.haml" do | ||
| 36 | end | 36 | end |
| 37 | 37 | ||
| 38 | def with_issue_tracker(tracker, problem) | 38 | def with_issue_tracker(tracker, problem) |
| 39 | - problem.app.issue_tracker = IssueTracker.new :type_tracker => tracker, :options => {:api_token => "token token token", :project_id => "1234"} | ||
| 40 | ErrbitPlugin::Registry.stub(:issue_trackers).and_return(trackers) | 39 | ErrbitPlugin::Registry.stub(:issue_trackers).and_return(trackers) |
| 40 | + problem.app.issue_tracker = IssueTracker.new :type_tracker => tracker, :options => {:api_token => "token token token", :project_id => "1234"} | ||
| 41 | + | ||
| 41 | view.stub(:problem).and_return(problem) | 42 | view.stub(:problem).and_return(problem) |
| 42 | view.stub(:app).and_return(problem.app) | 43 | view.stub(:app).and_return(problem.app) |
| 43 | end | 44 | end |