Skip to content

Commit

Permalink
Add failing spec
Browse files Browse the repository at this point in the history
  • Loading branch information
apuntovanini committed Nov 17, 2021
1 parent c0867d7 commit 4b19db0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/concerns/models/subscriber_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
expect(test_instance.subscriptions.latest_order.first).to eq(subscription_2)
expect(test_instance.subscriptions.latest_order.to_a).to eq(ActivityNotification::Subscription.filtered_by_target(test_instance).latest_order.to_a)
end

it "has many subscriptions with custom association name" do
ActivityNotification.config.subscription_table_name = 'notifications_subscriptions'

subscription_1 = create(:subscription, target: test_instance, key: 'subscription_key_1')
subscription_2 = create(:subscription, target: test_instance, key: 'subscription_key_2', created_at: subscription_1.created_at + 10.second)
expect(test_instance.notifications_subscriptions.count).to eq(2)
expect(test_instance.notifications_subscriptions.earliest_order.first).to eq(subscription_1)
expect(test_instance.notifications_subscriptions.latest_order.first).to eq(subscription_2)
expect(test_instance.notifications_subscriptions.latest_order.to_a).to eq(ActivityNotification::Subscription.filtered_by_target(test_instance).latest_order.to_a)
end
end

describe "as public class methods" do
Expand Down

0 comments on commit 4b19db0

Please sign in to comment.