Skip to content

Commit b41133f

Browse files
committed
test group stuff
1 parent e5b54c5 commit b41133f

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

spec/system/feed_edit_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ def visit_edit_feed
66
visit("/feeds/#{feed.id}/edit")
77
end
88

9+
it "does not show a group selector when the user has no groups" do
10+
login_as(default_user)
11+
visit_edit_feed
12+
13+
expect(page).to have_no_select("group-id")
14+
end
15+
916
it "allows updating a feed name" do
1017
login_as(default_user)
1118
visit_edit_feed

spec/system/import_spec.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,40 @@
2929

3030
expect(page).to have_content("We're getting you some stories to read")
3131
end
32+
33+
def import_grouped_opml
34+
file_path = Rails.root.join("spec/fixtures/feeds.opml")
35+
attach_file("opml_file", file_path, visible: false)
36+
expect(page).to have_text("We're getting you some stories to read")
37+
end
38+
39+
it "creates groups from the OPML structure" do
40+
login_as(default_user)
41+
visit(feeds_import_path)
42+
43+
import_grouped_opml
44+
45+
group_names = default_user.groups.pluck(:name)
46+
expect(group_names).to include("Football News", "RoR")
47+
end
48+
49+
it "assigns imported feeds to their groups" do
50+
login_as(default_user)
51+
visit(feeds_import_path)
52+
53+
import_grouped_opml
54+
55+
feed = default_user.feeds.find_by!(name: "TMW Football Transfer News")
56+
expect(feed.group.name).to eq("Football News")
57+
end
58+
59+
it "imports ungrouped feeds without a group" do
60+
login_as(default_user)
61+
visit(feeds_import_path)
62+
63+
import_grouped_opml
64+
65+
feed = default_user.feeds.find_by!(name: "Autoblog")
66+
expect(feed.group).to be_nil
67+
end
3268
end

0 commit comments

Comments
 (0)