diaspora/spec/helpers/report_helper_spec.rb
Lukas Matt 95072d6010 Add get_reported_guid spec for report helper
* two new methods in report model reported_author and item
* merge deletion methods in report model

Signed-off-by: Lukas Matt <lukas@zauberstuhl.de>
2015-10-03 17:17:06 +02:00

27 lines
869 B
Ruby

require "spec_helper"
describe ReportHelper, type: :helper do
before do
@user = bob
@post = @user.post(:status_message, text: "hello", to: @user.aspects.first.id)
@comment = @user.comment!(@post, "welcome")
end
describe "#get_reported_guid" do
it "returns user guid from post" do
expect(helper.get_reported_guid(@post, "post")) == @user.guid
end
it "returns user guid from comment" do
expect(helper.get_reported_guid(@comment, "comment")) == @user.guid
end
end
describe "#report_content" do
it "contains a link to the post" do
expect(helper.report_content(@post, "post")).to include %(href="#{post_path(@post)}")
end
it "contains an anchor to the comment" do
expect(helper.report_content(@comment, "comment")).to include %(href="#{post_path(@post, anchor: @comment.guid)}")
end
end
end