Added routing spec
authorNeil Smith <neil.git@njae.me.uk>
Mon, 6 Jan 2014 17:58:39 +0000 (17:58 +0000)
committerNeil Smith <neil.git@njae.me.uk>
Mon, 6 Jan 2014 17:58:39 +0000 (17:58 +0000)
spec/routing/feedcatcher_routing_spec.rb [new file with mode: 0644]

diff --git a/spec/routing/feedcatcher_routing_spec.rb b/spec/routing/feedcatcher_routing_spec.rb
new file mode 100644 (file)
index 0000000..6121c6b
--- /dev/null
@@ -0,0 +1,28 @@
+require 'spec_helper'
+
+describe "routes for feedcatcher" do
+  it "routes / to index" do
+    expect(get('/')).to route_to('feed#index')
+  end
+
+  it "routes /index(.:format) to feed#index" do
+    expect(get('/index')).to route_to('feed#index')
+    expect(get('/index.html')).to route_to(controller: 'feed', 
+                                           action: 'index', format: 'html')
+    expect(get('/index.rss')).to route_to(controller: 'feed', 
+                                          action: 'index', format: 'rss')
+  end
+
+  it "routes /:feed_name.:format) to feed" do
+    expect(get('/myfeed')).to route_to(controller: 'feed', 
+                                       action: 'show', feed_name: 'myfeed')
+    expect(get('/myfeed.html')).to route_to(controller: 'feed', 
+                                            action: 'show', 
+                                            feed_name: 'myfeed', 
+                                            format: 'html')
+    expect(get('/myfeed.rss')).to route_to(controller: 'feed', 
+                                           action: 'show', 
+                                           feed_name: 'myfeed', 
+                                           format: 'rss')
+  end
+end