Remove unnecessary specs
The test "display administrator id on public views" is not correct. The valuation comments are not display never on public views. If we reload this admin page we can see that the description is render instead of administrator_id as we can see at the upper test: ``` scenario "display administrator description on admin views" ``` The deleted test was passed because there is an error at the moment to render the comments. As we can see in the file ´app/views/comments/create.js.erb:10´ we try render comment without valuation value: ``` App.Comments.add_comment(parent_id, "<li><%= j(render @comment) %></li>"); ``` That it is necessary to render correctly the description or the id. By other hand the test "public users not see admin description" is already being checked in the 'system/comments_specs'. However, we are going to add a new expectation to make sure that the admin description does not appear on the public pages.
This commit is contained in:
@@ -20,7 +20,7 @@ describe "Commenting Budget::Investments" do
|
||||
expect(page).to have_content "I am your Admin!"
|
||||
end
|
||||
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
refresh
|
||||
|
||||
within "#comments" do
|
||||
expect(page).to have_content "I am your Admin!"
|
||||
@@ -29,42 +29,6 @@ describe "Commenting Budget::Investments" do
|
||||
expect(page).to have_css "img.admin-avatar"
|
||||
end
|
||||
end
|
||||
|
||||
scenario "display administrator id on public views" do
|
||||
admin = create(:administrator, description: "user description")
|
||||
|
||||
login_as(admin.user)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
fill_in "Leave your comment", with: "I am your Admin!"
|
||||
check "comment-as-administrator-budget_investment_#{investment.id}"
|
||||
click_button "Publish comment"
|
||||
|
||||
within "#comments" do
|
||||
expect(page).to have_content "I am your Admin!"
|
||||
expect(page).to have_content "Administrator ##{admin.id}"
|
||||
expect(page).to have_css "div.is-admin"
|
||||
expect(page).to have_css "img.admin-avatar"
|
||||
end
|
||||
end
|
||||
|
||||
scenario "public users not see admin description" do
|
||||
manuela = create(:user, username: "Manuela")
|
||||
admin = create(:administrator, user: manuela)
|
||||
comment = create(:comment,
|
||||
commentable: investment,
|
||||
user: manuela,
|
||||
administrator_id: admin.id)
|
||||
|
||||
visit budget_investment_path(investment.budget, investment)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content comment.body
|
||||
expect(page).to have_content "Administrator ##{admin.id}"
|
||||
expect(page).to have_css "img.admin-avatar"
|
||||
expect(page).to have_css "div.is-admin"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -570,7 +570,7 @@ describe "Comments" do
|
||||
|
||||
describe "Administrators" do
|
||||
scenario "can create comment" do
|
||||
admin = create(:administrator)
|
||||
admin = create(:administrator, description: "admin user")
|
||||
|
||||
login_as(admin.user)
|
||||
visit polymorphic_path(resource)
|
||||
@@ -584,6 +584,7 @@ describe "Comments" do
|
||||
within "#comments" do
|
||||
expect(page).to have_content "I am your Admin!"
|
||||
expect(page).to have_content "Administrator ##{admin.id}"
|
||||
expect(page).not_to have_content "Administrator admin user"
|
||||
expect(page).to have_css "div.is-admin"
|
||||
expect(page).to have_css "img.admin-avatar"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user