Guest User

Untitled

a guest
Apr 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. # Request in the feature -> ... the user show "foo" page by "login"
  2.  
  3. # -> features/support/paths.rb
  4. when /^the (.*) (edit|show)( "([^\"]*)")? page by "([^\"]*)"$/i
  5. case $2
  6. when "edit","show"
  7. klass = $1.singularize.capitalize.constantize
  8. obj = klass.send("find_by_#{$5.singularize}", $4) if $4 && $5
  9. raise "could not find #{$3} #{$1}" unless obj
  10. return self.send("edit_#{$1.downcase.singularize}_path",obj) if $2=="edit"
  11. return self.send("#{$1.singularize}_path",obj) if $2=="show"
  12. end
  13. when /^the (.*) (overview|new)( "([^\"]*)")? page$/i
  14. case $2
  15. when "new"
  16. self.send("new_#{$1.downcase.singularize}_path")
  17. when "overview"
  18. self.send("#{$1.downcase.pluralize}_path")
  19. end
Add Comment
Please, Sign In to add comment