forked from astashov/radiant-route-handler-extension
/
route_handler_controller_spec.rb
36 lines (32 loc) · 1.05 KB
/
route_handler_controller_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require File.dirname(__FILE__) + "/../spec_helper"
describe RouteHandlerController do
integrate_views
before do
@page = Page.create!(
:title => 'New Page',
:slug => 'page',
:breadcrumb => 'New Page',
:status_id => '1',
:parts => [{:name => "body", :content => "Hi there!"}],
:status_id => 100 # Published
)
@route_handler = RouteHandler.create!(
:url => '^(\w+)\/(\w+)$',
:description => "",
:fields => "name, date",
:page => @page
)
end
it "should open specified page" do
get :index, :path => [ 'dailyoverview', 'today' ]
response.should be_success
assigns(:route_handler).should == @route_handler
response.body.should include('Hi there!')
assigns(:page).route_handler_params.should == { :name => 'dailyoverview', :date => 'today' }
end
it "should show 404 error if there are no matched route handlers" do
get :index, :path => [ 'daily', 'overview', 'today' ]
response.should redirect_to('/404.html')
assigns(:route_handler).should be_nil
end
end