Compare commits
2 Commits
beb9b0c14a
...
f8499a79c2
| Author | SHA1 | Date |
|---|---|---|
|
|
f8499a79c2 | |
|
|
b97ee3f3bb |
8
app.rb
8
app.rb
|
|
@ -18,8 +18,12 @@ class App < Roda
|
|||
end
|
||||
|
||||
r.get String do | url_code |
|
||||
link = links.filter(:code => url_code).first[:url]
|
||||
r.redirect link
|
||||
link = links.filter(:code => url_code)
|
||||
if link.first.nil?
|
||||
flash['message'] = "Link #{url_code} doesn't exist"
|
||||
r.redirect '/'
|
||||
end
|
||||
r.redirect link.first[:url]
|
||||
end
|
||||
|
||||
r.post "create" do
|
||||
|
|
|
|||
|
|
@ -42,5 +42,5 @@ Feature: Homepage
|
|||
|
||||
Scenario: Accessing a nonexistent URL code
|
||||
Given I visit the "/aaaaaa" location
|
||||
Then I should be redirected to "/"
|
||||
Then I should be on "/" page
|
||||
And I should see the message "Link aaaaaa doesn't exist"
|
||||
|
|
|
|||
Loading…
Reference in New Issue