Rename some columns and indexes in the bug tables

This commit is contained in:
Tom Hughes 2011-05-08 17:39:27 +01:00
parent d2cf09f389
commit 882700c5c8
13 changed files with 175 additions and 148 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -20,29 +20,29 @@
<table>
<tr>
<th><%= t 'browse.bug.created_at' %></th>
<td><%= l @bug.date_created %></td>
<td><%= l @bug.created_at %></td>
</tr>
<tr>
<th><%= t 'browse.bug.edited_at' %></th>
<td><%= l @bug.last_changed %></td>
<td><%= l @bug.updated_at %></td>
</tr>
<% if @bug.status == "closed" %>
<tr>
<th><%= t 'browse.bug.closed_at' %></th>
<td><%= l @bug.date_closed %></td>
<td><%= l @bug.closed_at %></td>
</tr>
<% end %>
<tr>
<th><%= t 'browse.bug.opened_by' %></th>
<% if @bug.comments.first.user.nil? %>
<td> <%= @bug.comments.first.commenter_name %> </td>
<td> <%= @bug.comments.first.author_name %> </td>
<% else %>
<td><%= link_to h(@bug.comments.first.user.display_name), :controller => "user", :action => "view", :display_name => @bug.comments.first.user.display_name %></td>
<% end %>
</tr>
<tr>
<th><%= t 'browse.bug.description' %></th>
<td><%= h(@bug.comments.first.comment) %></td>
<td><%= h(@bug.comments.first.body) %></td>
</tr>
<tr>
<th><%= t 'browse.node_details.coordinates' %></th>
@ -63,13 +63,13 @@
<tr>
<td>
<% 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 %>
</td>
<td> <%= h(bug_comment.comment) %> </td>
<td> <%= l bug_comment.date_created %> </td>
<td> <%= h(bug_comment.body) %> </td>
<td> <%= l bug_comment.created_at %> </td>
</tr>
<% end %>
</table>

View file

@ -12,10 +12,10 @@ xml.item do
xml.description htmlize(bug.flatten_comment("<br><br>"))
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}"

View file

@ -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

View file

@ -13,7 +13,7 @@
<th><%= t'bugs.user.last_changed' %></th>
</tr>
<% @bugs.each do |bug| %>
<tr<% if bug.comments[0].user != @user2 %> bgcolor="#EEEEEE"<% end %>>
<tr<% if bug.comments.first.user != @user2 %> bgcolor="#EEEEEE"<% end %>>
<td>
<% if bug.status == "closed" %>
<%= image_tag("closed_bug_marker.png", :alt => 'closed') %>
@ -22,14 +22,14 @@
<% end %>
</td>
<td><%= link_to bug.id.to_s, :controller => "browse", :action => "bug", :id => bug.id %></td>
<% if bug.comments[0].user.nil? %>
<td> <%= bug.comments[0].commenter_name %> </td>
<% if bug.comments.first.user.nil? %>
<td> <%= bug.comments.first.author_name %> </td>
<% else %>
<td><%= link_to h(bug.comments[0].user.display_name), :controller => "user", :action => "view", :display_name => bug.comments[0].user.display_name %></td>
<td><%= link_to h(bug.comments.first.user.display_name), :controller => "user", :action => "view", :display_name => bug.comments.first.user.display_name %></td>
<% end %>
<td> <%= htmlize bug.comments[0].comment %> </td>
<td><%= l bug.date_created %></td>
<td><%= l bug.last_changed %></td>
<td> <%= htmlize bug.comments.first.body %> </td>
<td><%= l bug.created_at %></td>
<td><%= l bug.updated_at %></td>
</tr>
<% end %>
</table>

View file

@ -27,16 +27,16 @@ xml.rss("version" => "2.0",
if comment.event == "commented" and not comment.nil?
description_text += "<b>Comment:</b><br>"
description_text += htmlize(comment.comment)
description_text += htmlize(comment.body)
description_text += "<br>"
end
description_text += "<b>Full bug report:</b><br>"
description_text += comment.map_bug.flatten_comment("<br>", comment.date_created)
description_text += comment.map_bug.flatten_comment("<br>", 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}"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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