Add sanitization shared spec to budget investment

This commit is contained in:
Senén Rodero Rodríguez
2018-12-23 01:08:13 +01:00
committed by voodoorai2000
parent eb2e402a92
commit 88ce8d7990

View File

@@ -5,6 +5,7 @@ describe Budget::Investment do
describe "Concerns" do
it_behaves_like "notifiable"
it_behaves_like "sanitizable"
it_behaves_like "globalizable", :budget_investment
it_behaves_like "acts as imageable", :budget_investment_image
end
@@ -35,40 +36,6 @@ describe Budget::Investment do
end
end
describe "#description" do
it "is sanitized" do
investment.description = "<script>alert('danger');</script>"
investment.valid?
expect(investment.description).to eq("alert('danger');")
end
it "is sanitized using globalize accessors" do
investment.description_en = "<script>alert('danger');</script>"
investment.valid?
expect(investment.description_en).to eq("alert('danger');")
end
it "is html_safe" do
investment.description = "<script>alert('danger');</script>"
investment.valid?
expect(investment.description).to be_html_safe
end
it "is html_safe using globalize accessors" do
investment.description_en = "<script>alert('danger');</script>"
investment.valid?
expect(investment.description_en).to be_html_safe
end
end
it "set correct group and budget ids" do
budget = create(:budget)
group_1 = create(:budget_group, budget: budget)