Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/holman/hopper

  • Loading branch information...
commit aad1de72197ac2e605d1dfc483116c62615d06c1 2 parents b7769cf + 280392c
@holman authored
View
2  app/models/project.rb
@@ -67,7 +67,7 @@ def self.create(url)
# Returns the Project.
def self.find(id)
hash = $redis.hgetall("#{Project.key}:#{id}")
- new(hash['url'])
+ new(hash['url']) if hash.has_key?('url')
end
# Finds a Project by name.
View
4 app/templates/probe.mustache
@@ -10,6 +10,6 @@
</ul>
{{/metrics}}
- <a href="/probes/{{name}}/raw">Raw</a>
+ <p><a href="/probes/{{name}}/raw">Raw</a></p>
</section>
-</section>
+</section>
View
16 test/integration/app_test.rb
@@ -30,4 +30,20 @@
get "/projects/#{project.id}"
assert_match 'holman/play', last_response.body.strip
end
+
+ test '/projects/jump' do
+ project = Project.new('github.com/holman/play')
+ project.save
+ get "/projects/jump", :url => 'https://github.com/holman/play'
+
+ assert last_response.redirect?
+ assert_match "/projects/#{project.id}", last_response.location
+ end
+
+ test '/projects/jump (with non-existent project url)' do
+ get "/projects/jump", :url => 'https://github.com/non/existent'
+
+ assert last_response.redirect?
+ assert_match "/projects", last_response.location
+ end
end
View
4 test/unit/project_test.rb
@@ -165,4 +165,8 @@
@project.save
assert_equal @project.url, Project.find(@project.id).url
end
+
+ test 'find (with non-existent id)' do
+ assert_nil Project.find('123')
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.