Create changeset_comments resources for users
This commit is contained in:
parent
9fbe52dd21
commit
420d9da1f9
7 changed files with 91 additions and 1 deletions
37
test/controllers/users/changeset_comments_controller_test.rb
Normal file
37
test/controllers/users/changeset_comments_controller_test.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
require "test_helper"
|
||||
|
||||
module Users
|
||||
class ChangesetCommentsControllerTest < ActionDispatch::IntegrationTest
|
||||
##
|
||||
# test all routes which lead to this controller
|
||||
def test_routes
|
||||
assert_routing(
|
||||
{ :path => "/user/username/changeset_comments", :method => :get },
|
||||
{ :controller => "users/changeset_comments", :action => "index", :user_display_name => "username" }
|
||||
)
|
||||
end
|
||||
|
||||
def test_index
|
||||
user = create(:user)
|
||||
other_user = create(:user)
|
||||
changeset = create(:changeset, :closed)
|
||||
create_list(:changeset_comment, 3, :changeset => changeset, :author => user)
|
||||
create_list(:changeset_comment, 2, :changeset => changeset, :author => other_user)
|
||||
|
||||
get user_changeset_comments_path(user)
|
||||
assert_response :success
|
||||
assert_select "table.table-striped tbody" do
|
||||
assert_select "tr", :count => 3
|
||||
end
|
||||
|
||||
create(:changeset_comment, :changeset => changeset, :author => user)
|
||||
create(:changeset_comment, :changeset => changeset, :author => user, :visible => false)
|
||||
|
||||
get user_changeset_comments_path(user)
|
||||
assert_response :success
|
||||
assert_select "table.table-striped tbody" do
|
||||
assert_select "tr", :count => 4
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue