0
@@ -49,16 +49,40 @@ context "Dispatcher" do
0
assert_dispatch :single, nil, options, %w(2006 9 1 foo)
0
+ specify "should dispatch to comments" do
0
+ options = {:year => '2006', :month => '9', :day => '1', :permalink => 'foo'}
0
+ assert_dispatch :comments, nil, options, %w(2006 9 1 foo comments)
0
+ specify "should dispatch to single comment" do
0
+ options = {:year => '2006', :month => '9', :day => '1', :permalink => 'foo'}
0
+ assert_dispatch :comment, nil, options, '5', %w(2006 9 1 foo comments 5)
0
specify "should recognize permalinks" do
0
options = {:year => '2006', :month => '9', :day => '1', :permalink => 'foo'}
0
- assert_equal options, Mephisto::Dispatcher.recognize_permalink(@site, %w(2006 9 1 foo))
0
+ assert_equal [options, false, nil], Mephisto::Dispatcher.recognize_permalink(@site, %w(2006 9 1 foo))
0
+ @site.permalink_slug = 'entries/:id/:permalink'
0
+ @site.permalink_regex(true)
0
+ options = {:id => '5', :permalink => 'foo-bar-baz'}
0
+ assert_equal [options, false, nil], Mephisto::Dispatcher.recognize_permalink(@site, %w(entries 5 foo-bar-baz))
0
+ specify "should recognize permalinks with comment" do
0
+ options = {:year => '2006', :month => '9', :day => '1', :permalink => 'foo'}
0
+ assert_equal [options, true, nil], Mephisto::Dispatcher.recognize_permalink(@site, %w(2006 9 1 foo comments))
0
+ assert_equal [options, true, '5'], Mephisto::Dispatcher.recognize_permalink(@site, %w(2006 9 1 foo comments 5))
0
@site.permalink_slug = 'entries/:id/:permalink'
0
@site.permalink_regex(true)
0
options = {:id => '5', :permalink => 'foo-bar-baz'}
0
- assert_equal options, Mephisto::Dispatcher.recognize_permalink(@site, %w(entries 5 foo-bar-baz))
0
+ assert_equal [options, true, nil], Mephisto::Dispatcher.recognize_permalink(@site, %w(entries 5 foo-bar-baz comments))
0
+ assert_equal [options, true, '5'], Mephisto::Dispatcher.recognize_permalink(@site, %w(entries 5 foo-bar-baz comments 5))
0
specify "should ignore unrecognized permalinks" do
0
@@ -67,6 +91,8 @@ context "Dispatcher" do
0
assert_nil Mephisto::Dispatcher.recognize_permalink(sites(:first), %w(2006 239 1 foo))
0
assert_nil Mephisto::Dispatcher.recognize_permalink(sites(:first), %w(2006 9 123 foo))
0
assert_nil Mephisto::Dispatcher.recognize_permalink(sites(:first), %w(2006 9 1 a_b))
0
+ assert_nil Mephisto::Dispatcher.recognize_permalink(sites(:first), %w(2006 9 1 foo boo))
0
+ assert_nil Mephisto::Dispatcher.recognize_permalink(sites(:first), %w(2006 9 1 foo comment))
Comments
No one has commented yet.