spec/models/notification_spec.rb in activity_notification-1.0.2 vs spec/models/notification_spec.rb in activity_notification-1.1.0

- old
+ new

@@ -53,23 +53,23 @@ before { @notification = build(:notification) } it "is valid with target, notifiable and key" do expect(@notification).to be_valid end - + it "is invalid with blank target" do @notification.target = nil expect(@notification).to be_invalid expect(@notification.errors[:target].size).to eq(1) end - + it "is invalid with blank notifiable" do @notification.notifiable = nil expect(@notification).to be_invalid expect(@notification.errors[:notifiable].size).to eq(1) end - + it "is invalid with blank key" do @notification.key = nil expect(@notification).to be_invalid expect(@notification.errors[:key].size).to eq(1) end @@ -79,12 +79,12 @@ context "to filter by notification status" do before do ActivityNotification::Notification.delete_all @unopened_group_owner = create(:notification, group_owner: nil) @unopened_group_member = create(:notification, group_owner: @unopened_group_owner) - @opened_group_owner = create(:notification, group_owner: nil, opened_at: DateTime.now) - @opened_group_member = create(:notification, group_owner: @opened_group_owner, opened_at: DateTime.now) + @opened_group_owner = create(:notification, group_owner: nil, opened_at: Time.current) + @opened_group_member = create(:notification, group_owner: @opened_group_owner, opened_at: Time.current) end it "works with group_owners_only scope" do notifications = ActivityNotification::Notification.group_owners_only expect(notifications.size).to eq(2) @@ -289,11 +289,11 @@ context "to make order by created_at" do before do ActivityNotification::Notification.delete_all unopened_group_owner = create(:notification, group_owner: nil) unopened_group_member = create(:notification, group_owner: unopened_group_owner) - opened_group_owner = create(:notification, group_owner: nil, opened_at: DateTime.now) - opened_group_member = create(:notification, group_owner: opened_group_owner, opened_at: DateTime.now) + opened_group_owner = create(:notification, group_owner: nil, opened_at: Time.current) + opened_group_member = create(:notification, group_owner: opened_group_owner, opened_at: Time.current) @earliest_notification = unopened_group_owner @latest_notification = opened_group_member end it "works with latest_order scope" do