t1:
id: 1
- bug_id: 1
+ note_id: 1
visible: true
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'
-
+ body: 'This is the initial description of the note 1'
t2:
id: 2
- bug_id: 2
+ note_id: 2
visible: true
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'
-
+ body: 'This is the initial description of the note 2'
t3:
id: 3
- bug_id: 2
+ note_id: 2
visible: true
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'
-
+ body: 'This is an additional comment for note 2'
t4:
id: 4
- bug_id: 3
+ note_id: 3
visible: true
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'
+ body: 'This is the initial comment for note 3'
t5:
id: 5
- bug_id: 4
+ note_id: 4
visible: true
created_at: 2007-01-01 00:00:00
author_name: 'testname'
author_ip: '192.168.1.1'
- body: 'Spam for bug 4'
-
+ body: 'Spam for note 4'
t6:
id: 6
- bug_id: 5
+ note_id: 5
visible: true
created_at: 2007-01-01 00:00:00
author_name: 'testname'
author_ip: '192.168.1.1'
- body: 'Valid comment for bug 5'
+ body: 'Valid comment for note 5'
t7:
id: 7
- bug_id: 5
+ note_id: 5
visible: false
created_at: 2007-02-01 00:00:00
author_name: 'testname'
author_ip: '192.168.1.1'
- body: 'Spam for bug 5'
+ body: 'Spam for note 5'
t8:
id: 8
- bug_id: 5
+ note_id: 5
visible: true
created_at: 2007-02-01 00:00:00
author_name: 'testname'
author_ip: '192.168.1.1'
- body: 'Another valid comment for bug 5'
+ body: 'Another valid comment for note 5'
t9:
id: 9
- bug_id: 6
+ note_id: 6
visible: true
created_at: 2007-01-01 00:00:00
event: opened
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:
id: 10
- bug_id: 6
+ note_id: 6
visible: true
created_at: 2007-02-01 00:00:00
event: commented
author_id: 4
body: 'A comment from another logged-in user'
-
t11:
id: 11
- bug_id: 7
+ note_id: 7
visible: true
event: opened
created_at: 2007-01-01 00:00:00
author_name: 'testname'
author_ip: '192.168.1.1'
- body: 'Initial bug description'
-
+ body: 'Initial note description'
t12:
id: 12
- bug_id: 7
+ note_id: 7
visible: true
event: commented
created_at: 2007-02-01 00:00:00
t13:
id: 13
- bug_id: 7
+ note_id: 7
visible: true
event: closed
created_at: 2007-03-01 00:00:00
author_id: 4
-
-
-
-
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
<% SCALE = 10000000 unless defined?(SCALE) %>
-open_bug:
+open_note:
id: 1
latitude: <%= 1*SCALE %>
longitude: <%= 1*SCALE %>
created_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
latitude: <%= 1.1*SCALE %>
longitude: <%= 1.1*SCALE %>
created_at: 2007-01-01 00:00:00
updated_at: 2007-02-01 00:00:00
-closed_bug_with_comment:
+closed_note_with_comment:
id: 3
latitude: <%= 1.2*SCALE %>
longitude: <%= 1.2*SCALE %>
updated_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
latitude: <%= 1.3*SCALE %>
longitude: <%= 1.3*SCALE %>
created_at: 2007-01-01 00:00:00
updated_at: 2007-03-01 00:00:00
-bug_with_hidden_comment:
+note_with_hidden_comment:
id: 5
latitude: <%= 1.4*SCALE %>
longitude: <%= 1.4*SCALE %>
created_at: 2007-01-01 00:00:00
updated_at: 2007-03-01 00:00:00
-bug_with_comments_by_users:
+note_with_comments_by_users:
id: 6
latitude: <%= 1.5*SCALE %>
longitude: <%= 1.5*SCALE %>
created_at: 2007-01-01 00:00:00
updated_at: 2007-03-01 00:00:00
-
-bug_closed__by_user:
+note_closed_by_user:
id: 7
latitude: <%= 1.6*SCALE %>
longitude: <%= 1.6*SCALE %>
created_at: 2007-01-01 00:00:00
updated_at: 2007-03-01 00:00:00
closed_at: 2007-03-01 00:00:00
-
require File.dirname(__FILE__) + '/../test_helper'
-class MapBugsControllerTest < ActionController::TestCase
- fixtures :users, :map_bugs, :map_bug_comment
-
- def test_map_bug_create_success
- assert_difference('MapBug.count') do
- assert_difference('MapBugComment.count') do
+class NoteControllerTest < ActionController::TestCase
+ fixtures :users, :notes, :note_comments
+
+ def test_map_note_create_success
+ assert_difference('Note.count') do
+ assert_difference('NoteComment.count') do
post :create, {:lat => -1.0, :lon => -1.0, :name => "new_tester", :text => "This is a comment"}
end
end
assert_match "\"author_name\":\"new_tester (a)\"", js
end
- def test_map_bug_comment_create_success
- assert_difference('MapBugComment.count') do
+ def test_map_note_comment_create_success
+ assert_difference('NoteComment.count') do
post :update, {:id => 2, :name => "new_tester2", :text => "This is an additional comment"}
end
assert_response :success
assert_match "\"author_name\":\"new_tester2 (a)\"", js
end
- def test_map_bug_read_success
+ def test_map_note_read_success
get :read, {:id => 1}
assert_response :success
assert_response :success
end
- def test_map_bug_close_success
+ def test_map_note_close_success
post :close, {:id => 2}
assert_response :success
assert_match "\"status\":\"closed\"", js
end
- def test_get_bugs_success
+ def test_get_notes_success
get :list, {:bbox=>'1,1,1.2,1.2'}
assert_response :success
assert_response :success
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'}
assert_response :success
end
- def test_get_bugs_large_area_bad_request
+ def test_get_notes_large_area_bad_request
get :list, {:bbox=>'-10,-10,12,12'}
assert_response :bad_request
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'}
assert_response :success
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'}
assert_response :success
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'}
assert_response :success
end
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
- 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
- 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
- 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
- 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
end
assert_response :success
end
- def test_user_bugs_success
+ def test_user_notes_success
get :mine, {:display_name=>'test'}
assert_response :success
assert_response :not_found
end
- def test_map_bug_comment_create_not_found
- assert_no_difference('MapBugComment.count') do
+ def test_map_note_comment_create_not_found
+ assert_no_difference('NoteComment.count') do
post :update, {:id => 12345, :name => "new_tester", :text => "This is an additional comment"}
end
assert_response :not_found
end
- def test_map_bug_close_not_found
+ def test_map_note_close_not_found
post :close, {:id => 12345}
assert_response :not_found
end
- def test_map_bug_read_not_found
+ def test_map_note_read_not_found
get :read, {:id => 12345}
assert_response :not_found
end
- def test_map_bug_read_gone
+ def test_map_note_read_gone
get :read, {:id => 4}
assert_response :gone
end
- def test_map_bug_hidden_comment
+ def test_map_note_hidden_comment
get :read, {:id => 5, :format => 'json'}
assert_response :success
js = @response.body
assert_match "\"id\":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
+ assert_match "\"body\":\"Valid comment for note 5\"", js
+ assert_match "\"body\":\"Another valid comment for note 5\"", js
+ assert_no_match /\"body\":\"Spam for note 5\"/, js
end
end