Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improved specs

  • Loading branch information...
commit 57e2a1dd8fd8e1d44a1227bc85d2db5effeb050d 1 parent 2429466
@p8 p8 authored
View
12 app/models/redirect_page_tags.rb
@@ -0,0 +1,12 @@
+module RedirectPageTags
+ include Radiant::Taggable
+
+ tag "if_redirect_page" do |tag|
+ tag.expand if tag.locals.page.is_a? RedirectPage
+ end
+
+ tag "unless_redirect_page" do |tag|
+ tag.expand unless tag.locals.page.is_a? RedirectPage
+ end
+
+end
View
14 spec/models/page_redirect_spec.rb
@@ -63,16 +63,26 @@
@page.errors.on(:base).should match(/Redirect URL may not be the same/)
end
- it "should render if redirect" do
+ it "should render if_redirect_page if a RedirectPage" do
@page.should render(%{<r:if_redirect_page><r:title /></r:if_redirect_page>}).
as("Redirect")
end
- it "should render unless redirect" do
+ it "should not render if_redirect_page if not a RedirectPage" do
+ @root.should render(%{<r:if_redirect_page><r:title /></r:if_redirect_page>}).
+ as("")
+ end
+
+ it "should not render unless_redirect_page if a RedirectPage" do
@page.should render(%{<r:unless_redirect_page><r:title /></r:unless_redirect_page>}).
as("")
end
+ it "should render unless_redirect_page if not a RedirectPage" do
+ @root.should render(%{<r:unless_redirect_page><r:title /></r:unless_redirect_page>}).
+ as("Home")
+ end
+
# it "should err with 'Redirect URL may not be an existing redirect' when given a catch_url that matches the redirect_url" do
# @page.parts.build(:name => 'body', :content => 'things')
# @page.save!
Please sign in to comment.
Something went wrong with that request. Please try again.