From 882700c5c8890ba28dc83a9dc526b7bc242a0278 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 8 May 2011 17:39:27 +0100 Subject: [PATCH] Rename some columns and indexes in the bug tables --- app/controllers/map_bugs_controller.rb | 43 ++++----- app/models/map_bug.rb | 30 +++--- app/models/map_bug_comment.rb | 9 +- app/models/notifier.rb | 8 +- app/views/browse/bug.html.erb | 16 ++-- app/views/map_bugs/_bug.rss.builder | 4 +- app/views/map_bugs/_bug.xml.builder | 12 +-- app/views/map_bugs/my_bugs.html.erb | 14 +-- app/views/map_bugs/rss.rss.builder | 8 +- .../20110508145337_cleanup_bug_tables.rb | 37 +++++++ test/fixtures/map_bug_comment.yml | 96 +++++++++---------- test/fixtures/map_bugs.yml | 32 +++---- test/functional/map_bugs_controller_test.rb | 14 +-- 13 files changed, 175 insertions(+), 148 deletions(-) create mode 100644 db/migrate/20110508145337_cleanup_bug_tables.rb diff --git a/app/controllers/map_bugs_controller.rb b/app/controllers/map_bugs_controller.rb index f4105929f..8bd45bbcd 100644 --- a/app/controllers/map_bugs_controller.rb +++ b/app/controllers/map_bugs_controller.rb @@ -39,14 +39,14 @@ class MapBugsController < ApplicationController check_boundaries(@min_lon, @min_lat, @max_lon, @max_lat, MAX_BUG_REQUEST_AREA) - @bugs = MapBug.find_by_area(@min_lat, @min_lon, @max_lat, @max_lon, :include => :comments, :order => "last_changed DESC", :limit => limit, :conditions => conditions) + @bugs = MapBug.find_by_area(@min_lat, @min_lon, @max_lat, @max_lon, :include => :comments, :order => "updated_at DESC", :limit => limit, :conditions => conditions) respond_to do |format| format.html {render :template => 'map_bugs/get_bugs.js', :content_type => "text/javascript"} format.rss {render :template => 'map_bugs/get_bugs.rss'} format.js format.xml {render :template => 'map_bugs/get_bugs.xml'} - format.json { render :json => @bugs.to_json(:methods => [:lat, :lon], :only => [:id, :status, :date_created], :include => { :comments => { :only => [:commenter_name, :date_created, :comment]}}) } + format.json { render :json => @bugs.to_json(:methods => [:lat, :lon], :only => [:id, :status, :created_at], :include => { :comments => { :only => [:author_name, :created_at, :body]}}) } format.gpx {render :template => 'map_bugs/get_bugs.gpx'} end end @@ -80,9 +80,10 @@ class MapBugsController < ApplicationController rescue Exception => err @bug.nearby_place = "unknown" end - + @bug.save - add_comment(@bug, comment, name,"opened") + + add_comment(@bug, comment, name, "opened") end render_ok @@ -102,7 +103,7 @@ class MapBugsController < ApplicationController raise OSM::APIAlreadyDeletedError unless bug.visible MapBug.transaction do - bug_comment = add_comment(bug, params['text'], name,"commented") + bug_comment = add_comment(bug, params['text'], name, "commented") end render_ok @@ -121,7 +122,7 @@ class MapBugsController < ApplicationController MapBug.transaction do bug.close_bug - add_comment(bug,:nil,name,"closed") + add_comment(bug, :nil, name, "closed") end render_ok @@ -143,7 +144,7 @@ class MapBugsController < ApplicationController conditions = cond_merge conditions, [OSM.sql_for_area(@min_lat, @min_lon, @max_lat, @max_lon)] end - @comments = MapBugComment.find(:all, :limit => limit, :order => "date_created DESC", :joins => :map_bug, :include => :map_bug, :conditions => conditions) + @comments = MapBugComment.find(:all, :limit => limit, :order => "created_at DESC", :joins => :map_bug, :include => :map_bug, :conditions => conditions) render :template => 'map_bugs/rss.rss' end @@ -155,7 +156,7 @@ class MapBugsController < ApplicationController respond_to do |format| format.rss format.xml - format.json { render :json => @bug.to_json(:methods => [:lat, :lon], :only => [:id, :status, :date_created], :include => { :comments => { :only => [:commenter_name, :date_created, :comment]}}) } + format.json { render :json => @bug.to_json(:methods => [:lat, :lon], :only => [:id, :status, :created_at], :include => { :comments => { :only => [:author_name, :created_at, :body]}}) } format.gpx end end @@ -178,11 +179,11 @@ class MapBugsController < ApplicationController raise OSM::APIBadUserInput.new("No query string was given") unless params['q'] limit = getLimit conditions = closedCondition - conditions = cond_merge conditions, ['map_bug_comment.comment ~ ?', params['q']] + conditions = cond_merge conditions, ['map_bug_comment.body ~ ?', params['q']] #TODO: There should be a better way to do this. CloseConditions are ignored at the moment - bugs2 = MapBug.find(:all, :limit => limit, :order => "last_changed DESC", :joins => :comments, :include => :comments, + bugs2 = MapBug.find(:all, :limit => limit, :order => "updated_at DESC", :joins => :comments, :include => :comments, :conditions => conditions) @bugs = bugs2.uniq respond_to do |format| @@ -190,7 +191,7 @@ class MapBugsController < ApplicationController format.rss {render :template => 'map_bugs/get_bugs.rss'} format.js format.xml {render :template => 'map_bugs/get_bugs.xml'} - format.json { render :json => @bugs.to_json(:methods => [:lat, :lon], :only => [:id, :status, :date_created], :include => { :comments => { :only => [:commenter_name, :date_created, :comment]}}) } + format.json { render :json => @bugs.to_json(:methods => [:lat, :lon], :only => [:id, :status, :created_at], :include => { :comments => { :only => [:author_name, :created_at, :body]}}) } format.gpx {render :template => 'map_bugs/get_bugs.gpx'} end end @@ -201,7 +202,7 @@ class MapBugsController < ApplicationController if @user2 if @user2.data_public? or @user2 == @user - conditions = ['map_bug_comment.commenter_id = ?', @user2.id] + conditions = ['map_bug_comment.author_id = ?', @user2.id] else conditions = ['false'] end @@ -227,7 +228,7 @@ class MapBugsController < ApplicationController @bugs = MapBug.find(:all, :include => [:comments, {:comments => :user}], :joins => :comments, - :order => "last_changed DESC", + :order => "updated_at DESC", :conditions => conditions, :offset => (@page - 1) * @page_size, :limit => @page_size).uniq @@ -278,7 +279,7 @@ private if closed_since < 0 conditions = ["status != 'hidden'"] elsif closed_since > 0 - conditions = ["((status = 'open') OR ((status = 'closed' ) AND (date_closed > '" + (Time.now - closed_since.days).to_s + "')))"] + conditions = ["((status = 'open') OR ((status = 'closed' ) AND (closed_at > '" + (Time.now - closed_since.days).to_s + "')))"] else conditions = ["status = 'open'"] end @@ -287,18 +288,16 @@ private end def add_comment(bug, comment, name,event) - t = Time.now.getutc - bug_comment = bug.comments.create(:date_created => t, :visible => true, :event => event) - bug_comment.comment = comment unless comment == :nil + bug_comment = bug.comments.create(:visible => true, :event => event) + bug_comment.body = comment unless comment == :nil if @user - bug_comment.commenter_id = @user.id - bug_comment.commenter_name = @user.display_name + bug_comment.author_id = @user.id + bug_comment.author_name = @user.display_name else - bug_comment.commenter_ip = request.remote_ip - bug_comment.commenter_name = name + " (a)" + bug_comment.author_ip = request.remote_ip + bug_comment.author_name = name + " (a)" end bug_comment.save - bug.last_changed = t bug.save sent_to = Set.new diff --git a/app/models/map_bug.rb b/app/models/map_bug.rb index b07ef2941..2ae110bf2 100644 --- a/app/models/map_bug.rb +++ b/app/models/map_bug.rb @@ -1,36 +1,28 @@ class MapBug < ActiveRecord::Base include GeoRecord - has_many :comments, :class_name => "MapBugComment", - :foreign_key => :bug_id, - :order => :date_created, - :conditions => "visible = true and comment is not null" + has_many :comments, :class_name => "MapBugComment", + :foreign_key => :bug_id, + :order => :created_at, + :conditions => "visible = true AND body IS NOT NULL" validates_presence_of :id, :on => :update validates_uniqueness_of :id validates_numericality_of :latitude, :only_integer => true validates_numericality_of :longitude, :only_integer => true - validates_presence_of :date_created - validates_presence_of :last_changed - validates_presence_of :date_closed if :status == "closed" + validates_presence_of :closed_at if :status == "closed" validates_inclusion_of :status, :in => ["open", "closed", "hidden"] def self.create_bug(lat, lon) - bug = MapBug.new(:lat => lat, :lon => lon) + bug = MapBug.new(:lat => lat, :lon => lon, :status => "open") raise OSM::APIBadUserInput.new("The node is outside this world") unless bug.in_world? - bug.date_created = Time.now.getutc - bug.last_changed = Time.now.getutc - bug.status = "open" - return bug end def close_bug self.status = "closed" - close_time = Time.now.getutc - self.last_changed = close_time - self.date_closed = close_time + self.closed_at = Time.now.getutc self.save end @@ -39,12 +31,12 @@ class MapBug < ActiveRecord::Base resp = "" comment_no = 1 self.comments.each do |comment| - next if upto_timestamp != :nil and comment.date_created > upto_timestamp + next if upto_timestamp != :nil and comment.created_at > upto_timestamp resp += (comment_no == 1 ? "" : separator_char) - resp += comment.comment if comment.comment + resp += comment.body if comment.body resp += " [ " - resp += comment.commenter_name if comment.commenter_name - resp += " " + comment.date_created.to_s + " ]" + resp += comment.author_name if comment.author_name + resp += " " + comment.created_at.to_s + " ]" comment_no += 1 end diff --git a/app/models/map_bug_comment.rb b/app/models/map_bug_comment.rb index 50bfe3bef..28f16a9a9 100644 --- a/app/models/map_bug_comment.rb +++ b/app/models/map_bug_comment.rb @@ -2,17 +2,16 @@ class MapBugComment < ActiveRecord::Base set_table_name 'map_bug_comment' belongs_to :map_bug, :foreign_key => 'bug_id' - belongs_to :user, :foreign_key => 'commenter_id' + belongs_to :user, :foreign_key => 'author_id' validates_inclusion_of :event, :in => [ "opened", "closed", "reopened", "commented", "hidden" ] validates_presence_of :id, :on => :update validates_uniqueness_of :id validates_presence_of :visible - validates_presence_of :date_created - def commenter_name - if self.commenter_id.nil? - self.read_attribute(:commenter_name) + def author_name + if self.author_id.nil? + self.read_attribute(:author_name) else self.user.display_name end diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 26c236b7a..b7cb3454d 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -98,17 +98,17 @@ class Notifier < ActionMailer::Base def bug_comment_notification(bug_comment, recipient) common_headers recipient owner = (recipient == bug_comment.map_bug.comments.first.user); - subject I18n.t('notifier.map_bug_plain.subject_own', :commenter => bug_comment.commenter_name) if owner - subject I18n.t('notifier.map_bug_plain.subject_other', :commenter => bug_comment.commenter_name) unless owner + subject I18n.t('notifier.map_bug_plain.subject_own', :commenter => bug_comment.author_name) if owner + subject I18n.t('notifier.map_bug_plain.subject_other', :commenter => bug_comment.author_name) unless owner body :bugurl => url_for(:host => SERVER_URL, :controller => "browse", :action => "bug", :id => bug_comment.bug_id), :place => bug_comment.map_bug.nearby_place, - :comment => bug_comment.comment, + :comment => bug_comment.body, :owner => owner, - :commenter => bug_comment.commenter_name + :commenter => bug_comment.author_name end private diff --git a/app/views/browse/bug.html.erb b/app/views/browse/bug.html.erb index 9fd571abe..4364d1088 100644 --- a/app/views/browse/bug.html.erb +++ b/app/views/browse/bug.html.erb @@ -20,29 +20,29 @@ - + - + <% if @bug.status == "closed" %> - + <% end %> <% if @bug.comments.first.user.nil? %> - + <% else %> <% end %> - + @@ -63,13 +63,13 @@ - - + + <% end %>
<%= t 'browse.bug.created_at' %><%= l @bug.date_created %><%= l @bug.created_at %>
<%= t 'browse.bug.edited_at' %><%= l @bug.last_changed %><%= l @bug.updated_at %>
<%= t 'browse.bug.closed_at' %><%= l @bug.date_closed %><%= l @bug.closed_at %>
<%= t 'browse.bug.opened_by' %> <%= @bug.comments.first.commenter_name %> <%= @bug.comments.first.author_name %> <%= link_to h(@bug.comments.first.user.display_name), :controller => "user", :action => "view", :display_name => @bug.comments.first.user.display_name %>
<%= t 'browse.bug.description' %><%= h(@bug.comments.first.comment) %><%= h(@bug.comments.first.body) %>
<%= t 'browse.node_details.coordinates' %>
<% if bug_comment.user.nil? %> - <%= bug_comment.commenter_name %> + <%= bug_comment.author_name %> <% else %> <%= link_to h(bug_comment.user.display_name), :controller => "user", :action => "view", :display_name => bug_comment.user.display_name %> <% end %> <%= h(bug_comment.comment) %> <%= l bug_comment.date_created %> <%= h(bug_comment.body) %> <%= l bug_comment.created_at %>
diff --git a/app/views/map_bugs/_bug.rss.builder b/app/views/map_bugs/_bug.rss.builder index abfbc56d4..e928c3cac 100644 --- a/app/views/map_bugs/_bug.rss.builder +++ b/app/views/map_bugs/_bug.rss.builder @@ -12,10 +12,10 @@ xml.item do xml.description htmlize(bug.flatten_comment("

")) unless bug.comments.empty? - xml.author bug.comments[-1].commenter_name + xml.author bug.comments[-1].author_name end - xml.pubDate bug.last_changed.to_s(:rfc822) + xml.pubDate bug.updated_at.to_s(:rfc822) xml.geo :lat, bug.lat xml.geo :long, bug.lon xml.georss :point, "#{bug.lat} #{bug.lon}" diff --git a/app/views/map_bugs/_bug.xml.builder b/app/views/map_bugs/_bug.xml.builder index 32c98721e..1219f3d74 100644 --- a/app/views/map_bugs/_bug.xml.builder +++ b/app/views/map_bugs/_bug.xml.builder @@ -1,20 +1,20 @@ xml.bug("lon" => bug.lon, "lat" => bug.lat) do xml.id bug.id - xml.date_created bug.date_created + xml.date_created bug.created_at xml.nearby bug.nearby_place xml.status bug.status if bug.status == "closed" - xml.date_closed bug.date_closed + xml.date_closed bug.closed_at end xml.comments do bug.comments.each do |comment| xml.comment do - xml.date comment.date_created - xml.uid comment.commenter_id unless comment.commenter_id.nil? - xml.user comment.commenter_name - xml.text comment.comment + xml.date comment.created_at + xml.uid comment.author_id unless comment.author_id.nil? + xml.user comment.author_name + xml.text comment.body end end end diff --git a/app/views/map_bugs/my_bugs.html.erb b/app/views/map_bugs/my_bugs.html.erb index 9802ae1b2..5e6c7152b 100644 --- a/app/views/map_bugs/my_bugs.html.erb +++ b/app/views/map_bugs/my_bugs.html.erb @@ -13,7 +13,7 @@ <%= t'bugs.user.last_changed' %> <% @bugs.each do |bug| %> - bgcolor="#EEEEEE"<% end %>> + bgcolor="#EEEEEE"<% end %>> <% if bug.status == "closed" %> <%= image_tag("closed_bug_marker.png", :alt => 'closed') %> @@ -22,14 +22,14 @@ <% end %> <%= link_to bug.id.to_s, :controller => "browse", :action => "bug", :id => bug.id %> - <% if bug.comments[0].user.nil? %> - <%= bug.comments[0].commenter_name %> + <% if bug.comments.first.user.nil? %> + <%= bug.comments.first.author_name %> <% else %> - <%= link_to h(bug.comments[0].user.display_name), :controller => "user", :action => "view", :display_name => bug.comments[0].user.display_name %> + <%= link_to h(bug.comments.first.user.display_name), :controller => "user", :action => "view", :display_name => bug.comments.first.user.display_name %> <% end %> - <%= htmlize bug.comments[0].comment %> - <%= l bug.date_created %> - <%= l bug.last_changed %> + <%= htmlize bug.comments.first.body %> + <%= l bug.created_at %> + <%= l bug.updated_at %> <% end %> diff --git a/app/views/map_bugs/rss.rss.builder b/app/views/map_bugs/rss.rss.builder index ced183a10..566a3b322 100644 --- a/app/views/map_bugs/rss.rss.builder +++ b/app/views/map_bugs/rss.rss.builder @@ -27,16 +27,16 @@ xml.rss("version" => "2.0", if comment.event == "commented" and not comment.nil? description_text += "Comment:
" - description_text += htmlize(comment.comment) + description_text += htmlize(comment.body) description_text += "
" end description_text += "Full bug report:
" - description_text += comment.map_bug.flatten_comment("
", comment.date_created) + description_text += comment.map_bug.flatten_comment("
", comment.created_at) xml.description description_text - xml.author comment.commenter_name - xml.pubDate comment.date_created.to_s(:rfc822) + xml.author comment.author_name + xml.pubDate comment.created_at.to_s(:rfc822) xml.geo :lat, comment.map_bug.lat xml.geo :long, comment.map_bug.lon xml.georss :point, "#{comment.map_bug.lat} #{comment.map_bug.lon}" diff --git a/db/migrate/20110508145337_cleanup_bug_tables.rb b/db/migrate/20110508145337_cleanup_bug_tables.rb new file mode 100644 index 000000000..a5563ce0f --- /dev/null +++ b/db/migrate/20110508145337_cleanup_bug_tables.rb @@ -0,0 +1,37 @@ +class CleanupBugTables < ActiveRecord::Migration + def self.up + rename_column :map_bugs, :date_created, :created_at + rename_column :map_bugs, :last_changed, :updated_at + rename_column :map_bugs, :date_closed, :closed_at + + rename_index :map_bugs, :map_bugs_tile_idx, :map_bugs_tile_staus_idx + rename_index :map_bugs, :map_bugs_changed_idx, :map_bugs_updated_at_idx + rename_index :map_bugs, :map_bugs_created_idx, :map_bugs_created_at_idx + + rename_column :map_bug_comment, :date_created, :created_at + rename_column :map_bug_comment, :commenter_name, :author_name + rename_column :map_bug_comment, :commenter_ip, :author_ip + rename_column :map_bug_comment, :commenter_id, :author_id + rename_column :map_bug_comment, :comment, :body + + rename_index :map_bug_comment, :map_bug_comment_id_idx, :map_bug_comment_bug_id_idx + end + + def self.down + rename_index :map_bug_comment, :map_bug_comment_bug_id_idx, :map_bug_comment_id_idx + + rename_column :map_bug_comment, :body, :comment + rename_column :map_bug_comment, :author_id, :commenter_id + rename_column :map_bug_comment, :author_ip, :commenter_ip + rename_column :map_bug_comment, :author_name, :commenter_name + rename_column :map_bug_comment, :created_at, :date_created + + rename_index :map_bugs, :map_bugs_created_at_idx, :map_bugs_created_idx + rename_index :map_bugs, :map_bugs_updated_at_idx, :map_bugs_changed_idx + rename_index :map_bugs, :map_bugs_tile_staus_idx, :map_bugs_tile_idx + + rename_column :map_bugs, :closed_at, :date_closed + rename_column :map_bugs, :updated_at, :last_changed + rename_column :map_bugs, :created_at, :date_created + end +end diff --git a/test/fixtures/map_bug_comment.yml b/test/fixtures/map_bug_comment.yml index 2214c0764..a185c01e0 100644 --- a/test/fixtures/map_bug_comment.yml +++ b/test/fixtures/map_bug_comment.yml @@ -2,96 +2,96 @@ t1: id: 1 bug_id: 1 visible: true - date_created: 2007-01-01 00:00:00 - commenter_name: 'testname' - commenter_ip: '192.168.1.1' - comment: 'This is the initial description of the bug 1' + created_at: 2007-01-01 00:00:00 + author_name: 'testname' + author_ip: '192.168.1.1' + body: 'This is the initial description of the bug 1' t2: id: 2 bug_id: 2 visible: true - date_created: 2007-01-01 00:00:00 - commenter_name: 'testname' - commenter_ip: '192.168.1.1' - comment: 'This is the initial description of the bug 2' + created_at: 2007-01-01 00:00:00 + author_name: 'testname' + author_ip: '192.168.1.1' + body: 'This is the initial description of the bug 2' t3: id: 3 bug_id: 2 visible: true - date_created: 2007-02-01 00:00:00 - commenter_name: 'testname' - commenter_ip: '192.168.1.1' - comment: 'This is an additional comment for bug 2' + created_at: 2007-02-01 00:00:00 + author_name: 'testname' + author_ip: '192.168.1.1' + body: 'This is an additional comment for bug 2' t4: id: 4 bug_id: 3 visible: true - date_created: 2007-01-01 00:00:00 - commenter_name: 'testname' - commenter_ip: '192.168.1.1' - comment: 'This is the initial comment for bug 3' + created_at: 2007-01-01 00:00:00 + author_name: 'testname' + author_ip: '192.168.1.1' + body: 'This is the initial comment for bug 3' t5: id: 5 bug_id: 4 visible: true - date_created: 2007-01-01 00:00:00 - commenter_name: 'testname' - commenter_ip: '192.168.1.1' - comment: 'Spam for bug 4' + created_at: 2007-01-01 00:00:00 + author_name: 'testname' + author_ip: '192.168.1.1' + body: 'Spam for bug 4' t6: id: 6 bug_id: 5 visible: true - date_created: 2007-01-01 00:00:00 - commenter_name: 'testname' - commenter_ip: '192.168.1.1' - comment: 'Valid comment for bug 5' + created_at: 2007-01-01 00:00:00 + author_name: 'testname' + author_ip: '192.168.1.1' + body: 'Valid comment for bug 5' t7: id: 7 bug_id: 5 visible: false - date_created: 2007-02-01 00:00:00 - commenter_name: 'testname' - commenter_ip: '192.168.1.1' - comment: 'Spam for bug 5' + created_at: 2007-02-01 00:00:00 + author_name: 'testname' + author_ip: '192.168.1.1' + body: 'Spam for bug 5' t8: id: 8 bug_id: 5 visible: true - date_created: 2007-02-01 00:00:00 - commenter_name: 'testname' - commenter_ip: '192.168.1.1' - comment: 'Another valid comment for bug 5' + created_at: 2007-02-01 00:00:00 + author_name: 'testname' + author_ip: '192.168.1.1' + body: 'Another valid comment for bug 5' t9: id: 9 bug_id: 6 visible: true - date_created: 2007-01-01 00:00:00 + created_at: 2007-01-01 00:00:00 event: opened - commenter_id: 1 - comment: 'This is a bug with from a logged-in user' + author_id: 1 + body: 'This is a bug with from a logged-in user' t10: id: 10 bug_id: 6 visible: true - date_created: 2007-02-01 00:00:00 + created_at: 2007-02-01 00:00:00 event: commented - commenter_id: 4 - comment: 'A comment from another logged-in user' + author_id: 4 + body: 'A comment from another logged-in user' t11: @@ -99,10 +99,10 @@ t11: bug_id: 7 visible: true event: opened - date_created: 2007-01-01 00:00:00 - commenter_name: 'testname' - commenter_ip: '192.168.1.1' - comment: 'Initial bug description' + created_at: 2007-01-01 00:00:00 + author_name: 'testname' + author_ip: '192.168.1.1' + body: 'Initial bug description' t12: @@ -110,18 +110,18 @@ t12: bug_id: 7 visible: true event: commented - date_created: 2007-02-01 00:00:00 - commenter_name: 'testname' - commenter_ip: '192.168.1.1' - comment: 'A comment description' + created_at: 2007-02-01 00:00:00 + author_name: 'testname' + author_ip: '192.168.1.1' + body: 'A comment description' t13: id: 13 bug_id: 7 visible: true event: closed - date_created: 2007-03-01 00:00:00 - commenter_id: 4 + created_at: 2007-03-01 00:00:00 + author_id: 4 diff --git a/test/fixtures/map_bugs.yml b/test/fixtures/map_bugs.yml index 7c465ab0f..92a02a688 100644 --- a/test/fixtures/map_bugs.yml +++ b/test/fixtures/map_bugs.yml @@ -7,8 +7,8 @@ open_bug: longitude: <%= 1*SCALE %> status: open tile: <%= QuadTile.tile_for_point(1,1) %> - date_created: 2007-01-01 00:00:00 - last_changed: 2007-01-01 00:00:00 + created_at: 2007-01-01 00:00:00 + updated_at: 2007-01-01 00:00:00 open_bug_with_comment: id: 2 @@ -16,8 +16,8 @@ open_bug_with_comment: longitude: <%= 1.1*SCALE %> status: open tile: <%= QuadTile.tile_for_point(1.1,1.1) %> - date_created: 2007-01-01 00:00:00 - last_changed: 2007-02-01 00:00:00 + created_at: 2007-01-01 00:00:00 + updated_at: 2007-02-01 00:00:00 closed_bug_with_comment: id: 3 @@ -25,9 +25,9 @@ closed_bug_with_comment: longitude: <%= 1.2*SCALE %> status: closed tile: <%= QuadTile.tile_for_point(1.2,1.2) %> - date_created: 2007-01-01 00:00:00 - last_changed: 2007-03-01 00:00:00 - date_closed: 2007-03-01 00:00:00 + created_at: 2007-01-01 00:00:00 + updated_at: 2007-03-01 00:00:00 + closed_at: 2007-03-01 00:00:00 hidden_bug_with_comment: id: 4 @@ -35,8 +35,8 @@ hidden_bug_with_comment: longitude: <%= 1.3*SCALE %> status: hidden tile: <%= QuadTile.tile_for_point(1.3,1.3) %> - date_created: 2007-01-01 00:00:00 - last_changed: 2007-03-01 00:00:00 + created_at: 2007-01-01 00:00:00 + updated_at: 2007-03-01 00:00:00 bug_with_hidden_comment: id: 5 @@ -44,8 +44,8 @@ bug_with_hidden_comment: longitude: <%= 1.4*SCALE %> status: open tile: <%= QuadTile.tile_for_point(1.4,1.4) %> - date_created: 2007-01-01 00:00:00 - last_changed: 2007-03-01 00:00:00 + created_at: 2007-01-01 00:00:00 + updated_at: 2007-03-01 00:00:00 bug_with_comments_by_users: id: 6 @@ -53,8 +53,8 @@ bug_with_comments_by_users: longitude: <%= 1.5*SCALE %> status: open tile: <%= QuadTile.tile_for_point(1.5,1.5) %> - date_created: 2007-01-01 00:00:00 - last_changed: 2007-03-01 00:00:00 + created_at: 2007-01-01 00:00:00 + updated_at: 2007-03-01 00:00:00 bug_closed__by_user: @@ -63,7 +63,7 @@ bug_closed__by_user: longitude: <%= 1.6*SCALE %> status: closed tile: <%= QuadTile.tile_for_point(1.6,1.6) %> - date_created: 2007-01-01 00:00:00 - last_changed: 2007-03-01 00:00:00 - date_closed: 2007-03-01 00:00:00 + created_at: 2007-01-01 00:00:00 + updated_at: 2007-03-01 00:00:00 + closed_at: 2007-03-01 00:00:00 diff --git a/test/functional/map_bugs_controller_test.rb b/test/functional/map_bugs_controller_test.rb index ba47a007c..19c38834e 100644 --- a/test/functional/map_bugs_controller_test.rb +++ b/test/functional/map_bugs_controller_test.rb @@ -15,8 +15,8 @@ class MapBugsControllerTest < ActionController::TestCase assert_response :success js = @response.body assert_match "\"status\":\"open\"", js - assert_match "\"comment\":\"This is a comment\"", js - assert_match "\"commenter_name\":\"new_tester (a)\"", js + assert_match "\"body\":\"This is a comment\"", js + assert_match "\"author_name\":\"new_tester (a)\"", js end def test_map_bug_comment_create_success @@ -30,8 +30,8 @@ class MapBugsControllerTest < ActionController::TestCase js = @response.body assert_match "\"id\":2", js assert_match "\"status\":\"open\"", js - assert_match "\"comment\":\"This is an additional comment\"", js - assert_match "\"commenter_name\":\"new_tester2 (a)\"", js + assert_match "\"body\":\"This is an additional comment\"", js + assert_match "\"author_name\":\"new_tester2 (a)\"", js end def test_map_bug_read_success @@ -167,8 +167,8 @@ class MapBugsControllerTest < ActionController::TestCase assert_response :success js = @response.body assert_match "\"id\":5", js - assert_match "\"comment\":\"Valid comment for bug 5\"", js - assert_match "\"comment\":\"Another valid comment for bug 5\"", js - assert_no_match /\"comment\":\"Spam for bug 5\"/, js + assert_match "\"body\":\"Valid comment for bug 5\"", js + assert_match "\"body\":\"Another valid comment for bug 5\"", js + assert_no_match /\"body\":\"Spam for bug 5\"/, js end end -- 2.43.2