diff --git a/Gemfile b/Gemfile index 0b4feae..9103ac1 100644 --- a/Gemfile +++ b/Gemfile @@ -14,12 +14,13 @@ gem 'pivotal-tracker' gem 'ruby-fogbugz', :require => 'fogbugz', :path => '/Users/tracey/Development/gems/ruby-fogbugz' platform :ruby do - gem 'bson_ext', '~> 1.2' + gem 'bson_ext', '~> 1.3.1' end group :development, :test do gem 'rspec-rails', '~> 2.5' gem 'webmock', :require => false + gem 'ruby-debug19', :require => 'ruby-debug' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index c57644b..a772b69 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,11 +43,13 @@ GEM activesupport (= 3.0.5) activesupport (3.0.5) addressable (2.2.5) + archive-tar-minitar (0.5.2) arel (2.0.9) bcrypt-ruby (2.1.4) bson (1.3.1) - bson_ext (1.3.0) + bson_ext (1.3.1) builder (2.1.2) + columnize (0.3.4) crack (0.1.8) daemons (1.1.4) database_cleaner (0.6.7) @@ -72,6 +74,8 @@ GEM lighthouse-api (2.0) activeresource (>= 3.0.0) activesupport (>= 3.0.0) + linecache19 (0.5.12) + ruby_core_source (>= 0.1.4) mail (2.2.17) activesupport (>= 2.3.6) i18n (>= 0.4.0) @@ -130,6 +134,16 @@ GEM activesupport (~> 3.0) railties (~> 3.0) rspec (~> 2.5.0) + ruby-debug-base19 (0.11.25) + columnize (>= 0.3.1) + linecache19 (>= 0.5.11) + ruby_core_source (>= 0.1.4) + ruby-debug19 (0.11.6) + columnize (>= 0.3.1) + linecache19 (>= 0.5.11) + ruby-debug-base19 (>= 0.11.19) + ruby_core_source (0.1.5) + archive-tar-minitar (>= 0.5.2) thin (1.2.11) daemons (>= 1.0.9) eventmachine (>= 0.12.6) @@ -153,7 +167,7 @@ PLATFORMS ruby DEPENDENCIES - bson_ext (~> 1.2) + bson_ext (~> 1.3.1) database_cleaner (~> 0.6.0) devise (~> 1.1.8) email_spec @@ -168,6 +182,7 @@ DEPENDENCIES redmine_client! rspec (~> 2.5) rspec-rails (~> 2.5) + ruby-debug19 ruby-fogbugz! thin useragent (~> 0.3.1) diff --git a/app/models/app.rb b/app/models/app.rb index ad4d5ba..aba43ec 100644 --- a/app/models/app.rb +++ b/app/models/app.rb @@ -21,7 +21,7 @@ class App embeds_many :watchers embeds_many :deploys embeds_one :issue_tracker - has_many :errs, :dependent => :destroy + has_many :errs, :inverse_of => :app, :dependent => :destroy before_validation :generate_api_key, :on => :create before_save :normalize_github_url diff --git a/app/models/err.rb b/app/models/err.rb index a4b3857..badadce 100644 --- a/app/models/err.rb +++ b/app/models/err.rb @@ -16,7 +16,7 @@ class Err index :last_notice_at index :app_id - belongs_to :app, inverse_of: :errs + belongs_to :app has_many :notices validates_presence_of :klass, :environment diff --git a/app/models/issue_tracker.rb b/app/models/issue_tracker.rb index 7344d49..3a3fb08 100644 --- a/app/models/issue_tracker.rb +++ b/app/models/issue_tracker.rb @@ -76,14 +76,12 @@ class IssueTracker issue = {} issue['sTitle'] = issue_title err issue['sArea'] = project_id - puts err.app.inspect - puts app_err_url(err.app, err) issue['sEvent'] = self.class.fogbugz_body_template.result(binding) issue['sTags'] = ['errbit'].join(',') issue['cols'] = ['ixBug'].join(',') - # fb_resp = fogbugz.command(:new, issue) - # err.update_attribute :issue_link, "https://#{account}.fogbugz.com/default.asp?#{fb_resp['case']['ixBug']}" + fb_resp = fogbugz.command(:new, issue) + err.update_attribute :issue_link, "https://#{account}.fogbugz.com/default.asp?#{fb_resp['case']['ixBug']}" end def issue_title err diff --git a/app/views/errs/fogbugz_body.txt.erb b/app/views/errs/fogbugz_body.txt.erb index 38f0546..f0a356f 100644 --- a/app/views/errs/fogbugz_body.txt.erb +++ b/app/views/errs/fogbugz_body.txt.erb @@ -1,4 +1,5 @@ -"See this exception on Errbit": <%= app_err_url(err.app, err) %> +<% # some sort of stupid mongoid bugg that doesn't allow us to use err.app. have to explicitly search for it %> +"See this exception on Errbit": <%= app_err_url(App.where(_id: err.app_id).first, err) %> <% if notice = err.notices.first %> <%= notice.message %> diff --git a/app/views/errs/show.html.haml b/app/views/errs/show.html.haml index 3f97579..8d75d62 100644 --- a/app/views/errs/show.html.haml +++ b/app/views/errs/show.html.haml @@ -10,7 +10,8 @@ %strong Last Notice: = last_notice_at(@err).to_s(:micro) - content_for :action_bar do - - if @err.app.issue_tracker + / some sort of mongoid association bug or something. have to actually search for the stupid app instead of using @err.app + - if App.where(_id: @err.app_id).first.issue_tracker - if @err.issue_link.blank? %span= link_to 'create issue', create_issue_app_err_path(@app, @err), :method => :post, :class => "#{@app.issue_tracker.issue_tracker_type}_create create-issue" - else diff --git a/spec/controllers/apps_controller_spec.rb b/spec/controllers/apps_controller_spec.rb index 9b60a68..e34608e 100644 --- a/spec/controllers/apps_controller_spec.rb +++ b/spec/controllers/apps_controller_spec.rb @@ -266,12 +266,13 @@ describe AppsController do context 'with correct params' do before do put :update, :id => @app.id, :app => { :issue_tracker_attributes => { - :issue_tracker_type => 'fogbugz', :project_id => 'Service - Peon', :username => '1234', :password => '123123' } } + :issue_tracker_type => 'fogbugz', :account => 'abc', :project_id => 'Service - Peon', :username => '1234', :password => '123123' } } @app.reload end subject {@app.issue_tracker} its(:issue_tracker_type) {should == 'fogbugz'} + its(:account) {should == 'abc'} its(:project_id) {should == 'Service - Peon'} its(:username) {should == '1234'} its(:password) {should == '123123'} -- libgit2 0.21.2