Skip to content

Commit

Permalink
Adding coverage for successful case
Browse files Browse the repository at this point in the history
  • Loading branch information
pivotal committed Jun 18, 2008
1 parent 87a1f9c commit 2b2eabf
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions test/verify_recaptcha_test.rb
Expand Up @@ -5,18 +5,6 @@
require File.dirname(__FILE__) + '/../lib/recaptcha'

class VerifyReCaptchaTest < Test::Unit::TestCase
class TestController < Struct.new(:request, :params, :session)
include Ambethia::ReCaptcha
include Ambethia::ReCaptcha::Helper
include Ambethia::ReCaptcha::Controller

attr_accessor :request, :params, :session

def initialize
@session = {}
end
end

def setup
ENV['RECAPTCHA_PUBLIC_KEY'] = '0000000000000000000000000000000000000000'
ENV['RECAPTCHA_PRIVATE_KEY'] = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
Expand Down Expand Up @@ -49,6 +37,20 @@ def test_success
assert_nil @controller.session[:recaptcha_error]
end

private

class TestController < Struct.new(:request, :params, :session)
include Ambethia::ReCaptcha
include Ambethia::ReCaptcha::Helper
include Ambethia::ReCaptcha::Controller

attr_accessor :request, :params, :session

def initialize
@session = {}
end
end

def response_with_body(body)
stub(:body => body)
end
Expand Down

0 comments on commit 2b2eabf

Please sign in to comment.