Update tests for change in name from "map_bug" to "note" etc

This commit is contained in:
Tom Hughes 2011-05-22 12:40:56 +01:00
parent ab2acea49b
commit 08d6a0c910
3 changed files with 61 additions and 74 deletions

View file

@ -1,113 +1,106 @@
t1: t1:
id: 1 id: 1
bug_id: 1 note_id: 1
visible: true visible: true
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
author_name: 'testname' author_name: 'testname'
author_ip: '192.168.1.1' author_ip: '192.168.1.1'
body: 'This is the initial description of the bug 1' body: 'This is the initial description of the note 1'
t2: t2:
id: 2 id: 2
bug_id: 2 note_id: 2
visible: true visible: true
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
author_name: 'testname' author_name: 'testname'
author_ip: '192.168.1.1' author_ip: '192.168.1.1'
body: 'This is the initial description of the bug 2' body: 'This is the initial description of the note 2'
t3: t3:
id: 3 id: 3
bug_id: 2 note_id: 2
visible: true visible: true
created_at: 2007-02-01 00:00:00 created_at: 2007-02-01 00:00:00
author_name: 'testname' author_name: 'testname'
author_ip: '192.168.1.1' author_ip: '192.168.1.1'
body: 'This is an additional comment for bug 2' body: 'This is an additional comment for note 2'
t4: t4:
id: 4 id: 4
bug_id: 3 note_id: 3
visible: true visible: true
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
author_name: 'testname' author_name: 'testname'
author_ip: '192.168.1.1' author_ip: '192.168.1.1'
body: 'This is the initial comment for bug 3' body: 'This is the initial comment for note 3'
t5: t5:
id: 5 id: 5
bug_id: 4 note_id: 4
visible: true visible: true
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
author_name: 'testname' author_name: 'testname'
author_ip: '192.168.1.1' author_ip: '192.168.1.1'
body: 'Spam for bug 4' body: 'Spam for note 4'
t6: t6:
id: 6 id: 6
bug_id: 5 note_id: 5
visible: true visible: true
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
author_name: 'testname' author_name: 'testname'
author_ip: '192.168.1.1' author_ip: '192.168.1.1'
body: 'Valid comment for bug 5' body: 'Valid comment for note 5'
t7: t7:
id: 7 id: 7
bug_id: 5 note_id: 5
visible: false visible: false
created_at: 2007-02-01 00:00:00 created_at: 2007-02-01 00:00:00
author_name: 'testname' author_name: 'testname'
author_ip: '192.168.1.1' author_ip: '192.168.1.1'
body: 'Spam for bug 5' body: 'Spam for note 5'
t8: t8:
id: 8 id: 8
bug_id: 5 note_id: 5
visible: true visible: true
created_at: 2007-02-01 00:00:00 created_at: 2007-02-01 00:00:00
author_name: 'testname' author_name: 'testname'
author_ip: '192.168.1.1' author_ip: '192.168.1.1'
body: 'Another valid comment for bug 5' body: 'Another valid comment for note 5'
t9: t9:
id: 9 id: 9
bug_id: 6 note_id: 6
visible: true visible: true
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
event: opened event: opened
author_id: 1 author_id: 1
body: 'This is a bug with from a logged-in user' body: 'This is a note with from a logged-in user'
t10: t10:
id: 10 id: 10
bug_id: 6 note_id: 6
visible: true visible: true
created_at: 2007-02-01 00:00:00 created_at: 2007-02-01 00:00:00
event: commented event: commented
author_id: 4 author_id: 4
body: 'A comment from another logged-in user' body: 'A comment from another logged-in user'
t11: t11:
id: 11 id: 11
bug_id: 7 note_id: 7
visible: true visible: true
event: opened event: opened
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
author_name: 'testname' author_name: 'testname'
author_ip: '192.168.1.1' author_ip: '192.168.1.1'
body: 'Initial bug description' body: 'Initial note description'
t12: t12:
id: 12 id: 12
bug_id: 7 note_id: 7
visible: true visible: true
event: commented event: commented
created_at: 2007-02-01 00:00:00 created_at: 2007-02-01 00:00:00
@ -117,12 +110,8 @@ t12:
t13: t13:
id: 13 id: 13
bug_id: 7 note_id: 7
visible: true visible: true
event: closed event: closed
created_at: 2007-03-01 00:00:00 created_at: 2007-03-01 00:00:00
author_id: 4 author_id: 4

View file

@ -1,7 +1,7 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
<% SCALE = 10000000 unless defined?(SCALE) %> <% SCALE = 10000000 unless defined?(SCALE) %>
open_bug: open_note:
id: 1 id: 1
latitude: <%= 1*SCALE %> latitude: <%= 1*SCALE %>
longitude: <%= 1*SCALE %> longitude: <%= 1*SCALE %>
@ -10,7 +10,7 @@ open_bug:
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
updated_at: 2007-01-01 00:00:00 updated_at: 2007-01-01 00:00:00
open_bug_with_comment: open_note_with_comment:
id: 2 id: 2
latitude: <%= 1.1*SCALE %> latitude: <%= 1.1*SCALE %>
longitude: <%= 1.1*SCALE %> longitude: <%= 1.1*SCALE %>
@ -19,7 +19,7 @@ open_bug_with_comment:
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
updated_at: 2007-02-01 00:00:00 updated_at: 2007-02-01 00:00:00
closed_bug_with_comment: closed_note_with_comment:
id: 3 id: 3
latitude: <%= 1.2*SCALE %> latitude: <%= 1.2*SCALE %>
longitude: <%= 1.2*SCALE %> longitude: <%= 1.2*SCALE %>
@ -29,7 +29,7 @@ closed_bug_with_comment:
updated_at: 2007-03-01 00:00:00 updated_at: 2007-03-01 00:00:00
closed_at: 2007-03-01 00:00:00 closed_at: 2007-03-01 00:00:00
hidden_bug_with_comment: hidden_note_with_comment:
id: 4 id: 4
latitude: <%= 1.3*SCALE %> latitude: <%= 1.3*SCALE %>
longitude: <%= 1.3*SCALE %> longitude: <%= 1.3*SCALE %>
@ -38,7 +38,7 @@ hidden_bug_with_comment:
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
updated_at: 2007-03-01 00:00:00 updated_at: 2007-03-01 00:00:00
bug_with_hidden_comment: note_with_hidden_comment:
id: 5 id: 5
latitude: <%= 1.4*SCALE %> latitude: <%= 1.4*SCALE %>
longitude: <%= 1.4*SCALE %> longitude: <%= 1.4*SCALE %>
@ -47,7 +47,7 @@ bug_with_hidden_comment:
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
updated_at: 2007-03-01 00:00:00 updated_at: 2007-03-01 00:00:00
bug_with_comments_by_users: note_with_comments_by_users:
id: 6 id: 6
latitude: <%= 1.5*SCALE %> latitude: <%= 1.5*SCALE %>
longitude: <%= 1.5*SCALE %> longitude: <%= 1.5*SCALE %>
@ -56,8 +56,7 @@ bug_with_comments_by_users:
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
updated_at: 2007-03-01 00:00:00 updated_at: 2007-03-01 00:00:00
note_closed_by_user:
bug_closed__by_user:
id: 7 id: 7
latitude: <%= 1.6*SCALE %> latitude: <%= 1.6*SCALE %>
longitude: <%= 1.6*SCALE %> longitude: <%= 1.6*SCALE %>
@ -66,4 +65,3 @@ bug_closed__by_user:
created_at: 2007-01-01 00:00:00 created_at: 2007-01-01 00:00:00
updated_at: 2007-03-01 00:00:00 updated_at: 2007-03-01 00:00:00
closed_at: 2007-03-01 00:00:00 closed_at: 2007-03-01 00:00:00

View file

@ -1,11 +1,11 @@
require File.dirname(__FILE__) + '/../test_helper' require File.dirname(__FILE__) + '/../test_helper'
class MapBugsControllerTest < ActionController::TestCase class NoteControllerTest < ActionController::TestCase
fixtures :users, :map_bugs, :map_bug_comment fixtures :users, :notes, :note_comments
def test_map_bug_create_success def test_map_note_create_success
assert_difference('MapBug.count') do assert_difference('Note.count') do
assert_difference('MapBugComment.count') do assert_difference('NoteComment.count') do
post :create, {:lat => -1.0, :lon => -1.0, :name => "new_tester", :text => "This is a comment"} post :create, {:lat => -1.0, :lon => -1.0, :name => "new_tester", :text => "This is a comment"}
end end
end end
@ -19,8 +19,8 @@ class MapBugsControllerTest < ActionController::TestCase
assert_match "\"author_name\":\"new_tester (a)\"", js assert_match "\"author_name\":\"new_tester (a)\"", js
end end
def test_map_bug_comment_create_success def test_map_note_comment_create_success
assert_difference('MapBugComment.count') do assert_difference('NoteComment.count') do
post :update, {:id => 2, :name => "new_tester2", :text => "This is an additional comment"} post :update, {:id => 2, :name => "new_tester2", :text => "This is an additional comment"}
end end
assert_response :success assert_response :success
@ -34,7 +34,7 @@ class MapBugsControllerTest < ActionController::TestCase
assert_match "\"author_name\":\"new_tester2 (a)\"", js assert_match "\"author_name\":\"new_tester2 (a)\"", js
end end
def test_map_bug_read_success def test_map_note_read_success
get :read, {:id => 1} get :read, {:id => 1}
assert_response :success assert_response :success
@ -51,7 +51,7 @@ class MapBugsControllerTest < ActionController::TestCase
assert_response :success assert_response :success
end end
def test_map_bug_close_success def test_map_note_close_success
post :close, {:id => 2} post :close, {:id => 2}
assert_response :success assert_response :success
@ -61,7 +61,7 @@ class MapBugsControllerTest < ActionController::TestCase
assert_match "\"status\":\"closed\"", js assert_match "\"status\":\"closed\"", js
end end
def test_get_bugs_success def test_get_notes_success
get :list, {:bbox=>'1,1,1.2,1.2'} get :list, {:bbox=>'1,1,1.2,1.2'}
assert_response :success assert_response :success
@ -78,46 +78,46 @@ class MapBugsControllerTest < ActionController::TestCase
assert_response :success assert_response :success
end end
def test_get_bugs_large_area_success def test_get_notes_large_area_success
get :list, {:bbox=>'-2.5,-2.5,2.5,2.5'} get :list, {:bbox=>'-2.5,-2.5,2.5,2.5'}
assert_response :success assert_response :success
end end
def test_get_bugs_large_area_bad_request def test_get_notes_large_area_bad_request
get :list, {:bbox=>'-10,-10,12,12'} get :list, {:bbox=>'-10,-10,12,12'}
assert_response :bad_request assert_response :bad_request
end end
def test_get_bugs_closed_7_success def test_get_notes_closed_7_success
get :list, {:bbox=>'1,1,1.2,1.2', :closed => '7'} get :list, {:bbox=>'1,1,1.2,1.2', :closed => '7'}
assert_response :success assert_response :success
end end
def test_get_bugs_closed_0_success def test_get_notes_closed_0_success
get :list, {:bbox=>'1,1,1.2,1.2', :closed => '0'} get :list, {:bbox=>'1,1,1.2,1.2', :closed => '0'}
assert_response :success assert_response :success
end end
def test_get_bugs_closed_n1_success def test_get_notes_closed_n1_success
get :list, {:bbox=>'1,1,1.2,1.2', :closed => '-1'} get :list, {:bbox=>'1,1,1.2,1.2', :closed => '-1'}
assert_response :success assert_response :success
end end
def test_search_success def test_search_success
get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1'} get :search, {:bbox=>'1,1,1.2,1.2', :q => 'note 1'}
assert_response :success assert_response :success
get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1', :format => 'xml'} get :search, {:bbox=>'1,1,1.2,1.2', :q => 'note 1', :format => 'xml'}
assert_response :success assert_response :success
get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1', :format => 'json'} get :search, {:bbox=>'1,1,1.2,1.2', :q => 'note 1', :format => 'json'}
assert_response :success assert_response :success
get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1', :format => 'rss'} get :search, {:bbox=>'1,1,1.2,1.2', :q => 'note 1', :format => 'rss'}
assert_response :success assert_response :success
get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1', :format => 'gpx'} get :search, {:bbox=>'1,1,1.2,1.2', :q => 'note 1', :format => 'gpx'}
assert_response :success assert_response :success
end end
@ -129,7 +129,7 @@ class MapBugsControllerTest < ActionController::TestCase
assert_response :success assert_response :success
end end
def test_user_bugs_success def test_user_notes_success
get :mine, {:display_name=>'test'} get :mine, {:display_name=>'test'}
assert_response :success assert_response :success
@ -140,35 +140,35 @@ class MapBugsControllerTest < ActionController::TestCase
assert_response :not_found assert_response :not_found
end end
def test_map_bug_comment_create_not_found def test_map_note_comment_create_not_found
assert_no_difference('MapBugComment.count') do assert_no_difference('NoteComment.count') do
post :update, {:id => 12345, :name => "new_tester", :text => "This is an additional comment"} post :update, {:id => 12345, :name => "new_tester", :text => "This is an additional comment"}
end end
assert_response :not_found assert_response :not_found
end end
def test_map_bug_close_not_found def test_map_note_close_not_found
post :close, {:id => 12345} post :close, {:id => 12345}
assert_response :not_found assert_response :not_found
end end
def test_map_bug_read_not_found def test_map_note_read_not_found
get :read, {:id => 12345} get :read, {:id => 12345}
assert_response :not_found assert_response :not_found
end end
def test_map_bug_read_gone def test_map_note_read_gone
get :read, {:id => 4} get :read, {:id => 4}
assert_response :gone assert_response :gone
end end
def test_map_bug_hidden_comment def test_map_note_hidden_comment
get :read, {:id => 5, :format => 'json'} get :read, {:id => 5, :format => 'json'}
assert_response :success assert_response :success
js = @response.body js = @response.body
assert_match "\"id\":5", js assert_match "\"id\":5", js
assert_match "\"body\":\"Valid comment for bug 5\"", js assert_match "\"body\":\"Valid comment for note 5\"", js
assert_match "\"body\":\"Another valid comment for bug 5\"", js assert_match "\"body\":\"Another valid comment for note 5\"", js
assert_no_match /\"body\":\"Spam for bug 5\"/, js assert_no_match /\"body\":\"Spam for note 5\"/, js
end end
end end