spec/models/notification_spec.rb in activity_notification-0.0.8 vs spec/models/notification_spec.rb in activity_notification-0.0.9
- old
+ new
@@ -1,12 +1,13 @@
describe ActivityNotification::Notification, type: :model do
it_behaves_like :notification_api
+ it_behaves_like :renderable
describe "with association" do
it "belongs to target" do
- target = create(:user)
+ target = create(:confirmed_user)
notification = create(:notification, target: target)
expect(notification.reload.target).to eq(target)
end
it "belongs to notifiable" do
@@ -32,11 +33,11 @@
group_member = create(:notification, group_owner: group_owner)
expect(group_owner.reload.group_members.first).to eq(group_member)
end
it "belongs to notifier" do
- notifier = create(:user)
+ notifier = create(:confirmed_user)
notification = create(:notification, notifier: notifier)
expect(notification.reload.notifier).to eq(notifier)
end
end
@@ -166,11 +167,11 @@
end
context "to filter by association" do
before do
ActivityNotification::Notification.delete_all
- @target_1, @notifiable_1, @group_1, @key_1 = create(:user), create(:article), nil, "key.1"
- @target_2, @notifiable_2, @group_2, @key_2 = create(:user), create(:comment), @notifiable_1, "key.2"
+ @target_1, @notifiable_1, @group_1, @key_1 = create(:confirmed_user), create(:article), nil, "key.1"
+ @target_2, @notifiable_2, @group_2, @key_2 = create(:confirmed_user), create(:comment), @notifiable_1, "key.2"
@notification_1 = create(:notification, target: @target_1, notifiable: @notifiable_1, group: @group_1, key: @key_1)
@notification_2 = create(:notification, target: @target_2, notifiable: @notifiable_2, group: @group_2, key: @key_2)
end
it "works with filtered_by_target scope" do