spec/models/dorsale/comment_spec.rb in dorsale-3.5.2 vs spec/models/dorsale/comment_spec.rb in dorsale-3.6.0
- old
+ new
@@ -9,12 +9,21 @@
it { is_expected.to validate_presence_of :commentable }
it { is_expected.to validate_presence_of :date }
it { is_expected.to_not validate_presence_of :title }
- it "should have a valid factory" do
- expect(create(:dorsale_comment)).to be_valid
- end
+ describe "factories" do
+ it "should have a valid factory" do
+ expect(create(:dorsale_comment)).to be_valid
+ end
+
+ it "should create an event if commentable is a person" do
+ person = create(:customer_vault_corporation)
+ expect {
+ comment = create(:dorsale_comment, commentable: person)
+ }.to change(Dorsale::CustomerVault::Event, :count).by(1)
+ end
+ end # describe "factories"
describe "default values" do
it "should set date" do
expect(described_class.new.date).to be_present
end