Module: Adva::Blog::Paths

Defined in:
lib/testing/paths.rb

Instance Method Summary collapse

Instance Method Details

#path_to(page) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/testing/paths.rb', line 2

def path_to(page)
  case page

  when /^the admin posts list page of the "([^"]*)" blog$/
    section = Blog.find_by_name($1) || raise("could not find blog #{$1.inspect}")
    polymorphic_path([:admin, section.site, section])

  when /^the admin edit post page for the post "([^"]*)"$/
    post = Post.find_by_title($1) || raise("could not find post #{$1.inspect}")
    polymorphic_path([:edit, :admin, post.section.site, post.section, post])

  else
    super
  end
end