Skip to content

Commit 0de1552

Browse files
committed
Add some very mediocre tests
1 parent 0ad109a commit 0de1552

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
require "application_system_test_case"
2+
3+
class Hackathon::SubscriptionsTest < ApplicationSystemTestCase
4+
setup do
5+
seattle = {
6+
"city" => "Seattle",
7+
"state" => "Washington",
8+
"country_code" => "us",
9+
"coordinates" => [47.6038321, -122.330062]
10+
}
11+
Geocoder::Lookup::Test.add_stub("Seattle, Washington, US", [seattle])
12+
Geocoder::Lookup::Test.add_stub(seattle["coordinates"], [seattle.except("coordinates")])
13+
14+
@subscriber = users(:gary)
15+
@subscription = Hackathon::Subscription.find_or_create_by!(
16+
subscriber: @subscriber,
17+
city: "Seattle",
18+
province: "Washington",
19+
country_code: "US",
20+
status: :active
21+
)
22+
end
23+
24+
test "managing subscriptions" do
25+
visit Hackathon::Subscription.manage_subscriptions_url_for @subscriber
26+
assert_selector "h1", text: "Manage Subscriptions"
27+
end
28+
29+
test "invalid manage subscriptions link" do
30+
visit user_subscriptions_url @subscriber
31+
assert_text "expired"
32+
end
33+
34+
test "unsubscribe all" do
35+
visit Hackathon::Subscription.unsubscribe_all_url_for @subscriber
36+
assert_empty @subscriber.subscriptions.active
37+
end
38+
end

0 commit comments

Comments
 (0)