Skip to content

Commit

Permalink
Small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jferris committed Jan 28, 2010
1 parent 4f106ff commit 56cb7c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion features/step_definitions/rails_application_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
end

Then /^I should receive a Hoptoad notification$/ do
@terminal.output.should include("[Hoptoad] Success: Net::HTTPOK")
Then %{I should see "[Hoptoad] Success: Net::HTTPOK"}
end

Then /^I should receive two Hoptoad notifications$/ do
Expand Down
15 changes: 10 additions & 5 deletions lib/hoptoad_notifier/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
RAILS_DEFAULT_LOGGER.level = Logger::DEBUG

require 'action_controller/test_process'
require 'app/controllers/application' if File.exists?('app/controllers/application.rb')

request = ActionController::TestRequest.new
response = ActionController::TestResponse.new
Dir["app/controllers/application*.rb"].each { |file| require(file) }

class HoptoadTestingException < RuntimeError; end

Expand All @@ -48,6 +46,11 @@ class HoptoadTestingException < RuntimeError; end
puts sprintf("%25s: %s", key.to_s, value.inspect.slice(0, 55))
end

unless defined?(ApplicationController)
puts "No ApplicationController found"
exit
end

puts 'Setting up the Controller.'
class ApplicationController
# This is to bypass any filters that may prevent access to the action.
Expand All @@ -57,7 +60,7 @@ def test_hoptoad
raise exception_class.new, 'Testing hoptoad via "rake hoptoad:test". If you can see this, it works.'
end

def rescue_action exception
def rescue_action(exception)
rescue_action_in_public exception
end

Expand All @@ -83,9 +86,11 @@ def logger
nil
end
end
class HoptoadVerificationController < ApplicationController; end

puts 'Processing request.'
class HoptoadVerificationController < ApplicationController; end
request = ActionController::TestRequest.new
response = ActionController::TestResponse.new
HoptoadVerificationController.new.process(request, response)
end
end
Expand Down

0 comments on commit 56cb7c6

Please sign in to comment.