Merge pull request #975 from jermie/rss_loose

Use :loose option with feed-normalizer for now

Andrew Cantino 9 years ago
parent
commit
9367ff8a4b
3 changed files with 240 additions and 5 deletions
  1. 1 1
      app/models/agents/rss_agent.rb
  2. 221 0
      spec/data_fixtures/onethingwell.atom
  3. 18 4
      spec/models/agents/rss_agent_spec.rb

+ 1 - 1
app/models/agents/rss_agent.rb

@@ -97,7 +97,7 @@ module Agents
97 97
     def check_url(url)
98 98
       response = faraday.get(url)
99 99
       if response.success?
100
-        feed = FeedNormalizer::FeedNormalizer.parse(response.body)
100
+        feed = FeedNormalizer::FeedNormalizer.parse(response.body, loose: true)
101 101
         feed.clean! if boolify(interpolated['clean'])
102 102
         max_events = (interpolated['max_events_per_run'].presence || 0).to_i
103 103
         created_event_count = 0

+ 221 - 0
spec/data_fixtures/onethingwell.atom

@@ -0,0 +1,221 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
3
+    <channel>
4
+        <description>A weblog about simple, useful software (on any platform).</description>
5
+        <title>One Thing Well</title>
6
+        <generator>Tumblr (3.0; @onethingwell)</generator>
7
+        <link>http://onethingwell.org/</link>
8
+        <item>
9
+            <title>CSVfix</title>
10
+            <description>&lt;a href="http://neilb.bitbucket.org/csvfix/"&gt;CSVfix&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;CSVfix is a command-line tool specifically designed to deal with CSV data. With it you can, among other things:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Reorder, remove, split and merge fields&lt;/li&gt; &lt;li&gt;Convert case, trim leading &amp; trailing spaces&lt;/li&gt; &lt;li&gt;Search for specific content using regular expressions&lt;/li&gt; &lt;li&gt;Filter out duplicate data or data on exclusion lists&lt;/li&gt; &lt;li&gt;Enrich with data from other sources&lt;/li&gt; &lt;li&gt;Add sequence numbers and file source information&lt;/li&gt; &lt;li&gt;Split large CSV files into smaller files based on field contents&lt;/li&gt; &lt;li&gt;Perform arithmetic calculations on individual fields&lt;/li&gt; &lt;li&gt;Validate CSV data against a collection of validation rules&lt;/li&gt; &lt;li&gt;Convert between CSV and fixed format, XML, SQL and DSV&lt;/li&gt; &lt;/ul&gt;&lt;/blockquote&gt;
11
+            </description>
12
+            <link>http://onethingwell.org/post/127163643556</link>
13
+            <guid>http://onethingwell.org/post/127163643556</guid>
14
+            <pubDate>Thu, 20 Aug 2015 17:00:10 +0100</pubDate>
15
+            <category>csv</category>
16
+            <category>crossplatform</category>
17
+            <category>utilities</category>
18
+        </item>
19
+        <item>
20
+            <title>Gemini</title>
21
+            <description>&lt;a href="http://macpaw.com/gemini"&gt;Gemini&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;Find and remove identical files on your Mac&lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt;&lt;a href="https://geo.itunes.apple.com/us/app/gemini-the-duplicate-finder/id463541543?mt=12&amp;at=11l8NA"&gt;App Store&lt;/a&gt;&lt;/p&gt;</description>
22
+            <link>http://onethingwell.org/post/127157126678</link>
23
+            <guid>http://onethingwell.org/post/127157126678</guid>
24
+            <pubDate>Thu, 20 Aug 2015 15:00:19 +0100</pubDate>
25
+            <category>osx</category>
26
+            <category>utilities</category>
27
+        </item>
28
+        <item>
29
+            <title>FilePizza</title>
30
+            <description>&lt;a href="https://github.com/kern/filepizza"&gt;FilePizza&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;FilePizza enables fast and private peer-to-peer file transfers in your web browser.&lt;/p&gt; &lt;p&gt;By using &lt;a href="http://www.webrtc.org/"&gt;WebRTC&lt;/a&gt;, FilePizza eliminates the initial upload traditionally required when sharing files via file sharing services (e.g. Dropbox). Instead of transmitting files through an intermediary server, the sender initializes a transfer and receives a “tempalink” they can distribute. When recipients click on this link, they connect directly to the sender’s browser to complete the download. Because the file never touches the server, the transfer is fast, private, and secure.&lt;/p&gt; &lt;/blockquote&gt;
31
+            </description>
32
+            <link>http://onethingwell.org/post/127151806940</link>
33
+            <guid>http://onethingwell.org/post/127151806940</guid>
34
+            <pubDate>Thu, 20 Aug 2015 13:00:07 +0100</pubDate>
35
+            <category>web</category>
36
+        </item>
37
+        <item>
38
+            <title>itsycal</title>
39
+            <description>&lt;a href="http://www.mowglii.com/itsycal/"&gt;itsycal&lt;/a&gt;: &lt;p&gt;&lt;img src="http://c.1tw.org/images/2015/itsy.png" alt="A screenshot of Itsycal" width="100%" border="0"/&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Itsycal is a tiny [keyboard controlled] calendar for your Mac’s menu bar.&lt;/p&gt; &lt;p&gt;If you want, it will display your calendar events as a companion to the Mac Calendar app. You can also create and delete (but not edit) events.&lt;/p&gt; &lt;/blockquote&gt;
40
+            </description>
41
+            <link>http://onethingwell.org/post/127083371981</link>
42
+            <guid>http://onethingwell.org/post/127083371981</guid>
43
+            <pubDate>Wed, 19 Aug 2015 17:00:23 +0100</pubDate>
44
+            <category>calendar</category>
45
+            <category>menubar</category>
46
+            <category>osx</category>
47
+        </item>
48
+        <item>
49
+            <title>Magic Wormhole</title>
50
+            <description>&lt;a href="https://github.com/warner/magic-wormhole"&gt;Magic Wormhole&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;Get things from one computer to another, safely.&lt;/p&gt; &lt;p&gt;This package provides a library and a command-line tool named wormhole, which makes it possible to get short pieces of text (and arbitrary-sized files) from one computer to another. The two endpoints are identified by using identical “wormhole codes”: in general, the sending machine generates and displays the code, which must then be typed into the receiving machine.&lt;/p&gt; &lt;p&gt;The codes are short and human-pronounceable, using a phonetically-distinct wordlist. The receiving side offers tab-completion on the codewords, so usually only a few characters must be typed. Wormhole codes are single-use and do not need to be memorized.&lt;/p&gt; &lt;/blockquote&gt;
51
+            </description>
52
+            <link>http://onethingwell.org/post/127076852518</link>
53
+            <guid>http://onethingwell.org/post/127076852518</guid>
54
+            <pubDate>Wed, 19 Aug 2015 15:00:26 +0100</pubDate>
55
+            <category>files</category>
56
+            <category>transfer</category>
57
+            <category>cli</category>
58
+            <category>crossplatform</category>
59
+        </item>
60
+        <item>
61
+            <title>q</title>
62
+            <description>&lt;a href="http://harelba.github.io/q/"&gt;q&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;q is a command line tool that allows direct execution of SQL-like queries on CSVs/TSVs (and any other tabular text files).&lt;/p&gt; &lt;p&gt;q treats ordinary files as database tables, and supports all SQL constructs, such as WHERE, GROUP BY, JOINs etc. It supports automatic column name and column type detection, and provides full support for multiple encodings.&lt;/p&gt; &lt;/blockquote&gt;
63
+            </description>
64
+            <link>http://onethingwell.org/post/127071468395</link>
65
+            <guid>http://onethingwell.org/post/127071468395</guid>
66
+            <pubDate>Wed, 19 Aug 2015 13:00:28 +0100</pubDate>
67
+            <category>csv</category>
68
+            <category>sql</category>
69
+            <category>cli</category>
70
+            <category>crossplatform</category>
71
+        </item>
72
+        <item>
73
+            <title>Loose Leaves</title>
74
+            <description>&lt;a href="https://looseleav.es"&gt;Loose Leaves&lt;/a&gt;: &lt;p&gt;&lt;img src="http://c.1tw.org/images/2015/looseleaves.jpg" alt="A screenshot of Loose Leaves publishing Markdown text to the web" width="100%" border="0"/&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Loose Leaves for Mac lets you instantly create lightweight, beautiful, hosted pages from the Markdown you write.&lt;/p&gt; &lt;p&gt;Just select the Markdown you want to share, use the keyboard shortcut (⇧⌘C), and you instantly get back a secure link you can pass around.&lt;/p&gt; &lt;p&gt;Try Loose Leaves for posting drafts to Slack, notes to Twitter, project documents to Trello, or wherever you need to share your words.&lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt;&lt;a href="https://geo.itunes.apple.com/us/app/loose-leaves/id1011627372?ls=1&amp;mt=12&amp;at=11l8NA"&gt;App Store&lt;/a&gt;&lt;/p&gt;</description>
75
+            <link>http://onethingwell.org/post/127001339891</link>
76
+            <guid>http://onethingwell.org/post/127001339891</guid>
77
+            <pubDate>Tue, 18 Aug 2015 17:00:19 +0100</pubDate>
78
+            <category>osx</category>
79
+            <category>markdown</category>
80
+            <category>publishing</category>
81
+        </item>
82
+        <item>
83
+            <title>Stand</title>
84
+            <description>&lt;a href="https://getstandapp.com"&gt;Stand&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;Stand is a small Mac utility app that reminds you to stand once every hour by sending you a notification at the time you choose.&lt;/p&gt; &lt;/blockquote&gt;
85
+            </description>
86
+            <link>http://onethingwell.org/post/126994664474</link>
87
+            <guid>http://onethingwell.org/post/126994664474</guid>
88
+            <pubDate>Tue, 18 Aug 2015 15:00:19 +0100</pubDate>
89
+            <category>osx</category>
90
+            <category>notifications</category>
91
+            <category>health</category>
92
+        </item>
93
+        <item>
94
+            <title>GoTTY</title>
95
+            <description>&lt;a href="https://github.com/yudai/gotty"&gt;GoTTY&lt;/a&gt;: &lt;p&gt;&lt;img src="http://c.1tw.org/images/2015/gotty.gif" alt="An animated screenshot showing GoTTY displaying the output of 'top' and an interactive 'vi' session in a browser window." width="100%" border="0"/&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;GoTTY is a simple command line tool that turns your CLI tools into web applications.&lt;/p&gt; &lt;/blockquote&gt;
96
+            </description>
97
+            <link>http://onethingwell.org/post/126989247907</link>
98
+            <guid>http://onethingwell.org/post/126989247907</guid>
99
+            <pubDate>Tue, 18 Aug 2015 13:00:25 +0100</pubDate>
100
+            <category>browser</category>
101
+            <category>cli</category>
102
+            <category>terminal</category>
103
+            <category>linux</category>
104
+            <category>osx</category>
105
+        </item>
106
+        <item>
107
+            <title>Miller</title>
108
+            <description>&lt;a href="http://johnkerl.org/miller/doc/"&gt;Miller&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;Miller is like sed, awk, cut, join, and sort for name-indexed data such as CSV.&lt;/p&gt; &lt;/blockquote&gt; &lt;h4&gt; See also&lt;/h4&gt; &lt;ul&gt;&lt;li&gt;&lt;a href="http://onethingwell.org/post/16122304567/cvskit"&gt;cvskit&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://onethingwell.org/post/112136270664/xsv"&gt;xsv&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;
109
+            </description>
110
+            <link>http://onethingwell.org/post/126918320001</link>
111
+            <guid>http://onethingwell.org/post/126918320001</guid>
112
+            <pubDate>Mon, 17 Aug 2015 17:00:25 +0100</pubDate>
113
+            <category>cli</category>
114
+            <category>csv</category>
115
+            <category>crossplatform</category>
116
+        </item>
117
+        <item>
118
+            <title>termtile</title>
119
+            <description>&lt;a href="https://github.com/apaszke/termtile"&gt;termtile&lt;/a&gt;: &lt;p&gt;&lt;img src="http://c.1tw.org/images/2015/termtile.gif" alt="An animated screenshot showing termtile resizing and moving iTerm windows." width="100%" border="0"/&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;termtile is a set of scripts, which set you free from your mouse and touchpad. Don’t distract yourself and manage all your terminal windows with a handful of commands.&lt;/p&gt; &lt;p&gt;All scripts are written in AppleScript, so they are unfortunately limited to OS X at the moment.&lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt;With a command line interface–&lt;code&gt;ll&lt;/code&gt; makes a window fill the left half of your screen, &lt;code&gt;cen&lt;/code&gt; centers a window, &lt;code&gt;tile&lt;/code&gt; puts windows on a two by two grid, &lt;span class="amp"&gt;&amp;&lt;/span&gt;c..&lt;/p&gt;</description>
120
+            <link>http://onethingwell.org/post/126911729191</link>
121
+            <guid>http://onethingwell.org/post/126911729191</guid>
122
+            <pubDate>Mon, 17 Aug 2015 15:00:11 +0100</pubDate>
123
+            <category>osx</category>
124
+            <category>windowmanagers</category>
125
+            <category>cli</category>
126
+        </item>
127
+        <item>
128
+            <title>pex</title>
129
+            <description>&lt;a href="https://github.com/pantsbuild/pex"&gt;pex&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;pex is a library for generating .pex (Python EXecutable) files which are executable Python environments in the spirit of &lt;a href="http://virtualenv.org/"&gt;virtualenvs&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;pex… makes the deployment of Python applications as simple as &lt;code&gt;cp&lt;/code&gt;. pex files may even include multiple platform-specific Python distributions, meaning that a single pex file can be portable across Linux and OS X.&lt;/p&gt; &lt;/blockquote&gt;
130
+            </description>
131
+            <link>http://onethingwell.org/post/126906360476</link>
132
+            <guid>http://onethingwell.org/post/126906360476</guid>
133
+            <pubDate>Mon, 17 Aug 2015 13:00:15 +0100</pubDate>
134
+            <category>python</category>
135
+            <category>packages</category>
136
+            <category>development</category>
137
+        </item>
138
+        <item>
139
+            <title>Tufte CSS</title>
140
+            <description>&lt;a href="http://www.daveliepmann.com/tufte-css/"&gt;Tufte CSS&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;Tufte CSS provides tools to style web articles using the ideas demonstrated by &lt;a href="https://en.wikipedia.org/wiki/Edward_Tufte"&gt;Edward Tufte&lt;/a&gt;’s books and handouts. Tufte’s style is known for its simplicity, extensive use of sidenotes, tight integration of graphics with text, and carefully chosen typography.&lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt;&lt;small&gt;Via &lt;a href="https://projects.metafilter.com/4676/Tufte-CSS"&gt;MetaFilter Projects&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;</description>
141
+            <link>http://onethingwell.org/post/126675602938</link>
142
+            <guid>http://onethingwell.org/post/126675602938</guid>
143
+            <pubDate>Fri, 14 Aug 2015 17:00:32 +0100</pubDate>
144
+            <category>web</category>
145
+            <category>design</category>
146
+            <category>css</category>
147
+        </item>
148
+        <item>
149
+            <title>drive</title>
150
+            <description>&lt;a href="https://github.com/odeke-em/drive"&gt;drive&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;&lt;code&gt;drive&lt;/code&gt; is a tiny program to pull or push &lt;a href="https://www.google.com/drive/"&gt;Google Drive&lt;/a&gt; files.&lt;/p&gt; &lt;/blockquote&gt;
151
+            </description>
152
+            <link>http://onethingwell.org/post/126669045710</link>
153
+            <guid>http://onethingwell.org/post/126669045710</guid>
154
+            <pubDate>Fri, 14 Aug 2015 15:00:04 +0100</pubDate>
155
+            <category>google</category>
156
+            <category>storage</category>
157
+            <category>crossplatform</category>
158
+        </item>
159
+        <item>
160
+            <title>mycli</title>
161
+            <description>&lt;a href="http://mycli.net"&gt;mycli&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;Mycli is a command line interface for MySQL, MariaDB, and Percona with auto-completion and syntax highlighting.&lt;/p&gt; &lt;/blockquote&gt; &lt;h4&gt; See also&lt;/h4&gt; &lt;ul&gt;&lt;li&gt;&lt;a href="http://onethingwell.org/post/109879472006/pgcli"&gt;pgcli&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;
162
+            </description>
163
+            <link>http://onethingwell.org/post/126663781661</link>
164
+            <guid>http://onethingwell.org/post/126663781661</guid>
165
+            <pubDate>Fri, 14 Aug 2015 13:00:31 +0100</pubDate>
166
+            <category>cli</category>
167
+            <category>mysql</category>
168
+            <category>crossplatform</category>
169
+        </item>
170
+        <item>
171
+            <title>Resflash</title>
172
+            <description>&lt;a href="http://stable.rcesoftware.com/resflash/"&gt;Resflash&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;Resflash is a tool for building &lt;a href="http://www.openbsd.org/"&gt;OpenBSD&lt;/a&gt; images for embedded and cloud systems in a reproducible way.&lt;/p&gt; &lt;p&gt;Resflash exclusively uses read-only and memory-backed filesystems, and because the partitions are only written to during system upgrades… filesystems are not subject to corruption or &lt;code&gt;fsck&lt;/code&gt; due to power loss - and even cheap flash drives can last virtually forever. Resflash images can be written to any bootable flash media, such as USB drives, SD cards, or Compact Flash, or even conventional hard drives or SSDs.&lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt;&lt;small&gt;Via &lt;a href="https://twitter.com/nixcraft/status/624637300215971840"&gt;@nixcraft&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;</description>
173
+            <link>http://onethingwell.org/post/126588833246</link>
174
+            <guid>http://onethingwell.org/post/126588833246</guid>
175
+            <pubDate>Thu, 13 Aug 2015 15:00:21 +0100</pubDate>
176
+            <category>bsd</category>
177
+            <category>images</category>
178
+        </item>
179
+        <item>
180
+            <title>Numi</title>
181
+            <description>&lt;a href="http://numi.io"&gt;Numi&lt;/a&gt;: &lt;p&gt;&lt;img src="http://c.1tw.org/images/2015/numi.png" alt="A screenshot of Numi showing its currency &amp; unit conversion features, date handling and CSS unit support." width="100%" border="0"/&gt;&lt;/p&gt; &lt;p&gt;Numi is a calculator for OS X with support for all sorts of everyday maths tasks, from dates, currency conversion and quick percentage calculations to CSS units.&lt;/p&gt;</description>
182
+            <link>http://onethingwell.org/post/126583572564</link>
183
+            <guid>http://onethingwell.org/post/126583572564</guid>
184
+            <pubDate>Thu, 13 Aug 2015 13:00:33 +0100</pubDate>
185
+            <category>calculators</category>
186
+            <category>osx</category>
187
+        </item>
188
+        <item>
189
+            <title>MatrixPen</title>
190
+            <description>&lt;a href="http://richardallen.me/matrixpen/"&gt;MatrixPen&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;MatrixPen takes the hassle out of drawing to an 8x8 LED matrix from an &lt;a href="https://en.wikipedia.org/wiki/Arduino" title="Arduino"&gt;Arduino&lt;/a&gt;. Draw on your Mac and export straight to code. Leave the bitshifting to us.&lt;/p&gt; &lt;/blockquote&gt;
191
+            </description>
192
+            <link>http://onethingwell.org/post/125522030053</link>
193
+            <guid>http://onethingwell.org/post/125522030053</guid>
194
+            <pubDate>Fri, 31 Jul 2015 17:00:21 +0100</pubDate>
195
+            <category>arduino</category>
196
+            <category>osx</category>
197
+        </item>
198
+        <item>
199
+            <title>FORD</title>
200
+            <description>&lt;a href="https://github.com/cmacmackin/ford/"&gt;FORD&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;Automatically generates FORtran Documentation from comments within the code.&lt;/p&gt; &lt;p&gt;The goal of FORD is to be able to reliably produce documentation for modern Fortran software which is informative and nice to look at. The documentation should be easy to write and non-obtrusive within the code.&lt;/p&gt; &lt;/blockquote&gt;
201
+            </description>
202
+            <link>http://onethingwell.org/post/125515167956</link>
203
+            <guid>http://onethingwell.org/post/125515167956</guid>
204
+            <pubDate>Fri, 31 Jul 2015 15:00:10 +0100</pubDate>
205
+            <category>fortran</category>
206
+            <category>documentation</category>
207
+            <category>crossplatform</category>
208
+        </item>
209
+        <item>
210
+            <title>Showgoers</title>
211
+            <description>&lt;a href="http://showgoers.tv/"&gt;Showgoers&lt;/a&gt;: &lt;blockquote&gt; &lt;p&gt;Showgoers is a Chrome browser extension to synchronize your Netflix player with someone else so that you can co-watch the same movie on different computers with no hassle. Syncing up your player is as easy as sharing a URL.&lt;/p&gt; &lt;/blockquote&gt;
212
+            </description>
213
+            <link>http://onethingwell.org/post/125509667816</link>
214
+            <guid>http://onethingwell.org/post/125509667816</guid>
215
+            <pubDate>Fri, 31 Jul 2015 13:00:13 +0100</pubDate>
216
+            <category>netflix</category>
217
+            <category>chrome</category>
218
+            <category>extensions</category>
219
+        </item>
220
+    </channel>
221
+</rss>

+ 18 - 4
spec/models/agents/rss_agent_spec.rb

@@ -9,6 +9,7 @@ describe Agents::RssAgent do
9 9
 
10 10
     stub_request(:any, /github.com/).to_return(:body => File.read(Rails.root.join("spec/data_fixtures/github_rss.atom")), :status => 200)
11 11
     stub_request(:any, /SlickdealsnetFP/).to_return(:body => File.read(Rails.root.join("spec/data_fixtures/slickdeals.atom")), :status => 200)
12
+    stub_request(:any, /onethingwell.org/).to_return(:body => File.read(Rails.root.join("spec/data_fixtures/onethingwell.atom")), :status => 200)
12 13
   end
13 14
 
14 15
   let(:agent) do
@@ -111,10 +112,10 @@ describe Agents::RssAgent do
111 112
         agent.check
112 113
       }.to change { agent.events.count }.by(20 + 79)
113 114
     end
114
-    
115
+
115 116
     it "should fetch one event per run" do
116 117
       agent.options['url'] = ["https://github.com/cantino/huginn/commits/master.atom"]
117
-      
118
+
118 119
       agent.options['max_events_per_run'] = 1
119 120
       agent.check
120 121
       expect(agent.events.count).to eq(1)
@@ -122,7 +123,7 @@ describe Agents::RssAgent do
122 123
 
123 124
     it "should fetch all events per run" do
124 125
       agent.options['url'] = ["https://github.com/cantino/huginn/commits/master.atom"]
125
-      
126
+
126 127
       # <= 0 should ignore option and get all
127 128
       agent.options['max_events_per_run'] = 0
128 129
       agent.check
@@ -149,9 +150,22 @@ describe Agents::RssAgent do
149 150
     end
150 151
   end
151 152
 
153
+  context "parsing feeds" do
154
+    before do
155
+      @valid_options['url'] = 'http://onethingwell.org/rss'
156
+    end
157
+
158
+    it "captures multiple categories" do
159
+      agent.check
160
+      first, *, third = agent.events.take(3)
161
+      expect(first.payload['categories']).to eq(["csv", "crossplatform", "utilities"])
162
+      expect(third.payload['categories']).to eq(["web"])
163
+    end
164
+  end
165
+
152 166
   describe 'logging errors with the feed url' do
153 167
     it 'includes the feed URL when an exception is raised' do
154
-      mock(FeedNormalizer::FeedNormalizer).parse(anything) { raise StandardError.new("Some error!") }
168
+      mock(FeedNormalizer::FeedNormalizer).parse(anything, loose: true) { raise StandardError.new("Some error!") }
155 169
       expect(lambda {
156 170
         agent.check
157 171
       }).not_to raise_error