diff --git a/app/assets/images/campfire_goto.png b/app/assets/images/campfire_goto.png index d7e468b..5bc5337 100644 Binary files a/app/assets/images/campfire_goto.png and b/app/assets/images/campfire_goto.png differ diff --git a/app/models/issue_tracker.rb b/app/models/issue_tracker.rb index f8bb84e..6c35057 100644 --- a/app/models/issue_tracker.rb +++ b/app/models/issue_tracker.rb @@ -14,7 +14,7 @@ class IssueTracker field :username, :type => String field :password, :type => String field :ticket_properties, :type => String - field :room_id, :type => String + field :subdomain, :type => String validate :check_params diff --git a/app/models/issue_trackers/campfire_tracker.rb b/app/models/issue_trackers/campfire_tracker.rb index 8d75a7e..f85d889 100644 --- a/app/models/issue_trackers/campfire_tracker.rb +++ b/app/models/issue_trackers/campfire_tracker.rb @@ -1,7 +1,7 @@ class IssueTrackers::CampfireTracker < IssueTracker Label = "campfire" Fields = [ - [:account, { + [:subdomain, { :placeholder => "Campfire Subdomain" }], [:api_token, { @@ -9,22 +9,22 @@ class IssueTrackers::CampfireTracker < IssueTracker }], [:project_id, { :placeholder => "Room ID", - :label => "Room ID", + :label => "Room ID" }], ] def check_params if Fields.detect {|f| self[f[0]].blank? } - errors.add :base, 'You must specify your Campfire subdomain, API token and Room ID' + errors.add :base, 'You must specify your Campfire Subdomain, API token and Room ID' end end def create_issue(problem, reported_by = nil) # build the campfire client - campy = Campy::Room.new(:account => account, :token => api_token, :room_id => project_id) + campy = Campy::Room.new(:account => subdomain, :token => api_token, :room_id => project_id) # post the issue to the campfire room - campy.paste issue_title problem + campy.paste "[errbit] http://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} #{issue_title problem}" # update the problem to say where it was sent problem.update_attributes( @@ -34,6 +34,6 @@ class IssueTrackers::CampfireTracker < IssueTracker end def url - "http://#{account}.campfirenow.com" + "http://#{subdomain}.campfirenow.com" end end \ No newline at end of file diff --git a/spec/fabricators/issue_tracker_fabricator.rb b/spec/fabricators/issue_tracker_fabricator.rb index f745bc0..ffefa0d 100644 --- a/spec/fabricators/issue_tracker_fabricator.rb +++ b/spec/fabricators/issue_tracker_fabricator.rb @@ -25,3 +25,9 @@ Fabricator :github_issues_tracker, :from => :issue_tracker, :class_name => "Issu username 'test_username' end +Fabricator :campfire_tracker, :from => :issue_tracker, :class_name => "IssueTrackers::CampfireTracker" do + subdomain 'camproomname' + api_token 1234567890 + project_id 888555 +end + diff --git a/spec/models/issue_trackers/campfire_tracker_spec.rb b/spec/models/issue_trackers/campfire_tracker_spec.rb new file mode 100644 index 0000000..0c187e3 --- /dev/null +++ b/spec/models/issue_trackers/campfire_tracker_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe IssueTrackers::CampfireTracker do + it "should post the error to campfire and display the error" do + # setup fabrications + notice = Fabricate :notice + tracker = Fabricate :campfire_tracker + + # stub out campy methods + Campy::Room.stub(:new).and_return(tracker) + tracker.stub(:paste) { true } + + # make sure campy received a message to send to campfire + tracker.should_receive(:paste) + + # create the issue + tracker.create_issue(notice.problem) + end +end + -- libgit2 0.21.2