Skip to content
Permalink
Browse files

bump Rails, and fixes for Rails 5.1.4

  • Loading branch information...
matthutchinson committed Jan 17, 2018
1 parent 1b3703a commit cc5b43de7c0cb2e9021457e81fb0298a2a3f8031
Showing with 12 additions and 12 deletions.
  1. +3 −3 Appraisals
  2. +1 −1 acts_as_textcaptcha.gemspec
  3. +3 −3 test/textcaptcha_api_test.rb
  4. +1 −1 test/textcaptcha_cache_test.rb
  5. +4 −4 test/textcaptcha_test.rb
@@ -1,11 +1,11 @@
appraise "rails-3" do
gem "rails", "3.2.22.4"
gem "rails", "3.2.22.5"
end

appraise "rails-4" do
gem "rails", "4.2.7.1"
gem "rails", "4.2.10"
end

appraise "rails-5" do
gem "rails", "5.0.0.1"
gem "rails", "5.1.4"
end
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]

# always test against latest rails version
s.add_development_dependency('rails', '~> 5.0.0.1')
s.add_development_dependency('rails', '~> 5.1.4')

s.add_development_dependency('mime-types')
s.add_development_dependency('bundler')
@@ -30,17 +30,17 @@
URI::InvalidURIError
].each do |error|
stub_request(:get, "http://textcaptcha.com/api/xyz").to_raise(error)
ActsAsTextcaptcha::TextcaptchaApi.fetch('xyz').must_equal nil
assert_nil ActsAsTextcaptcha::TextcaptchaApi.fetch('xyz')
end
end

it 'should return nil when body cannot be parsed as XML' do
stub_request(:get, "http://textcaptcha.com/api/jibber").to_return(:body => 'here be gibberish')
ActsAsTextcaptcha::TextcaptchaApi.fetch('jibber').must_equal nil
assert_nil ActsAsTextcaptcha::TextcaptchaApi.fetch('jibber')
end

it 'should return nil when body is empty' do
stub_request(:get, "http://textcaptcha.com/api/empty").to_return(:body => '')
ActsAsTextcaptcha::TextcaptchaApi.fetch('empty').must_equal nil
assert_nil ActsAsTextcaptcha::TextcaptchaApi.fetch('empty')
end
end
@@ -20,6 +20,6 @@
@cache.read('mykey').must_equal [1,2,3]
@cache.delete('mykey')

@cache.read('mykey').must_equal nil
assert_nil @cache.read('mykey')
end
end
@@ -131,17 +131,17 @@

stub_request(:get, %r{http://textcaptcha.com/api/}).to_raise(SocketError)
@comment.textcaptcha
@comment.textcaptcha_question.must_equal nil
@comment.textcaptcha_key.must_equal nil
assert_nil @comment.textcaptcha_question
assert_nil @comment.textcaptcha_key
end

it 'should not generate any question or answer when user defined questions set incorrectly' do
@comment = MovieReview.new

stub_request(:get, %r{http://textcaptcha.com/api/}).to_raise(SocketError)
@comment.textcaptcha
@comment.textcaptcha_question.must_equal nil
@comment.textcaptcha_key.must_equal nil
assert_nil @comment.textcaptcha_question
assert_nil @comment.textcaptcha_key
end
end

0 comments on commit cc5b43d

Please sign in to comment.
You can’t perform that action at this time.