Compare commits

..

No commits in common. "f8499a79c2c8cd6b5e495886dc436010945bd55a" and "beb9b0c14a639fabd0e3374d25bf579b48604855" have entirely different histories.

2 changed files with 3 additions and 7 deletions

8
app.rb
View File

@ -18,12 +18,8 @@ class App < Roda
end
r.get String do | url_code |
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]
link = links.filter(:code => url_code).first[:url]
r.redirect link
end
r.post "create" do

View File

@ -42,5 +42,5 @@ Feature: Homepage
Scenario: Accessing a nonexistent URL code
Given I visit the "/aaaaaa" location
Then I should be on "/" page
Then I should be redirected to "/"
And I should see the message "Link aaaaaa doesn't exist"