Compare commits
No commits in common. "f8499a79c2c8cd6b5e495886dc436010945bd55a" and "beb9b0c14a639fabd0e3374d25bf579b48604855" have entirely different histories.
f8499a79c2
...
beb9b0c14a
8
app.rb
8
app.rb
|
|
@ -18,12 +18,8 @@ class App < Roda
|
||||||
end
|
end
|
||||||
|
|
||||||
r.get String do | url_code |
|
r.get String do | url_code |
|
||||||
link = links.filter(:code => url_code)
|
link = links.filter(:code => url_code).first[:url]
|
||||||
if link.first.nil?
|
r.redirect link
|
||||||
flash['message'] = "Link #{url_code} doesn't exist"
|
|
||||||
r.redirect '/'
|
|
||||||
end
|
|
||||||
r.redirect link.first[:url]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
r.post "create" do
|
r.post "create" do
|
||||||
|
|
|
||||||
|
|
@ -42,5 +42,5 @@ Feature: Homepage
|
||||||
|
|
||||||
Scenario: Accessing a nonexistent URL code
|
Scenario: Accessing a nonexistent URL code
|
||||||
Given I visit the "/aaaaaa" location
|
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"
|
And I should see the message "Link aaaaaa doesn't exist"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue