Fix tests
This commit is contained in:
Vendored
+1
-1
@@ -56,7 +56,7 @@ layout_created:
|
||||
|
||||
layout_commented:
|
||||
creator: david
|
||||
action: comment
|
||||
action: commented
|
||||
summary: layout_initial_activity
|
||||
particulars: <%= { comment_id: ActiveRecord::FixtureSet.identify(:layout_overflowing_david) }.to_json %>
|
||||
created_at: <%= 1.week.ago %>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class Notifier::AssignedTest < ActiveSupport::TestCase
|
||||
test "generate creates a notification for each recipient" do
|
||||
test "creates a notification for the assignee" do
|
||||
assert_difference -> { Notification.count }, 1 do
|
||||
assert_difference -> { users(:kevin).notifications.count }, 1 do
|
||||
Notifier.for(events(:logo_assignment_km)).generate
|
||||
@@ -9,17 +9,18 @@ class Notifier::AssignedTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
test "generate does not notify for self-assignments" do
|
||||
event = EventSummary.last.events.create! action: :assigned, creator: users(:kevin), particulars: { assignee_ids: [ users(:kevin).id ] }
|
||||
test "does not notify for self-assignments" do
|
||||
event = EventSummary.last.events.create! action: :assigned, creator: users(:kevin),
|
||||
particulars: { assignee_ids: [ users(:kevin).id ] }
|
||||
|
||||
assert_no_difference -> { Notification.count } do
|
||||
Notifier.for(event).generate
|
||||
end
|
||||
end
|
||||
|
||||
test "generate populates the notification details" do
|
||||
test "links to the bubble" do
|
||||
Notifier.for(events(:logo_assignment_km)).generate
|
||||
|
||||
assert_equal "assigned you: The logo isn't big enough", Notification.last.body
|
||||
assert_equal bubbles(:logo), Notification.last.resource
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
require "test_helper"
|
||||
|
||||
class Notifier::CommentedTest < ActiveSupport::TestCase
|
||||
test "creates a notification for each recipient" do
|
||||
assert_difference -> { Notification.count }, 2 do
|
||||
assert_difference -> { users(:kevin).notifications.count }, 1 do
|
||||
assert_difference -> { users(:jz).notifications.count }, 1 do
|
||||
Notifier.for(events(:layout_commented)).generate
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
test "links to the bubble" do
|
||||
Notifier.for(events(:layout_commented)).generate
|
||||
|
||||
assert_equal comments(:layout_overflowing_david), Notification.last.resource
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class Notifier::CreatedTest < ActiveSupport::TestCase
|
||||
test "generate creates a notification for each recipient" do
|
||||
test "creates a notification for each recipient" do
|
||||
assert_difference -> { Notification.count }, 2 do
|
||||
assert_difference -> { users(:kevin).notifications.count }, 1 do
|
||||
assert_difference -> { users(:jz).notifications.count }, 1 do
|
||||
@@ -11,9 +11,9 @@ class Notifier::CreatedTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
test "generate populates the notification details" do
|
||||
test "links to the bubble" do
|
||||
Notifier.for(events(:logo_created)).generate
|
||||
|
||||
assert_equal "created: The logo isn't big enough", Notification.last.body
|
||||
assert_equal bubbles(:logo), Notification.last.resource
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
require "test_helper"
|
||||
|
||||
class Notifier::PoppedTest < ActiveSupport::TestCase
|
||||
test "generate populates the notification details" do
|
||||
test "creates a notification for each recipient" do
|
||||
assert_difference -> { Notification.count }, 2 do
|
||||
assert_difference -> { users(:david).notifications.count }, 1 do
|
||||
assert_difference -> { users(:jz).notifications.count }, 1 do
|
||||
Notifier.for(events(:shipping_popped)).generate
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
test "links to the bubble" do
|
||||
Notifier.for(events(:shipping_popped)).generate
|
||||
|
||||
assert_equal "popped: We need to ship the app", Notification.last.body
|
||||
assert_equal bubbles(:shipping), Notification.last.resource
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user