Skip to content

Commit

Permalink
CI updates and fixes (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
markets committed Mar 17, 2019
1 parent acbdc7a commit 0494554
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 18 deletions.
20 changes: 14 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,31 @@ cache: bundler
sudo: false
rvm:
- ruby-head
- 2.5.1
- 2.4.4
- 2.3.6
- 2.2.9
- 2.6.2
- 2.5.5
- 2.4.5
- 2.3.8
- 2.2.10
gemfile:
- gemfiles/rails_5.2.gemfile
- gemfiles/rails_5.1.gemfile
- gemfiles/rails_5.0.gemfile
- gemfiles/rails_4.2.gemfile
- gemfiles/rails_3.2.gemfile
before_install:
# Rails 4.x requires Bundler version < 2.0.
- "find /home/travis/.rvm/rubies -wholename '*default/bundler-*.gemspec' -delete"
- rvm @global do gem uninstall bundler -a -x
- rvm @global do yes | gem install bundler -v '< 2'
matrix:
exclude:
- rvm: ruby-head
gemfile: gemfiles/rails_3.2.gemfile
- rvm: 2.5.1
- rvm: 2.6.2
gemfile: gemfiles/rails_3.2.gemfile
- rvm: 2.4.4
- rvm: 2.5.5
gemfile: gemfiles/rails_3.2.gemfile
- rvm: 2.4.5
gemfile: gemfiles/rails_3.2.gemfile
allow_failures:
- rvm: ruby-head
2 changes: 1 addition & 1 deletion Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ appraise "rails-5.0" do
end

appraise "rails-4.2" do
gem "rails", github: 'rails/rails', branch: '4-2-stable'
gem "rails", "~> 4.2.0"
end

appraise "rails-3.2" do
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,18 @@ If you intend to use I18n with `invisible_captcha`, you _must not_ set `sentence
If you're encountering unexpected behaviour while testing controllers that use the `invisible_captcha` action filter, you may want to disable timestamp check for the test environment:

```ruby
# test/test_helper.rb, spec/rails_helper.rb
# test/test_helper.rb, spec/rails_helper.rb, ...
InvisibleCaptcha.timestamp_enabled = false

```

Another option is to wait for the timestamp check to be valid:

```ruby
# Maybe in a before block.
# Maybe in a before block
InvisibleCaptcha.init!
InvisibleCaptcha.timestamp_threshold = 1

# Before testing your controller action.
# Before testing your controller action
sleep InvisibleCaptcha.timestamp_threshold
```

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_3.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source "https://rubygems.org"

gem "rails", "~> 3.2.0"

gemspec :path => "../"
gemspec path: "../"
4 changes: 2 additions & 2 deletions gemfiles/rails_4.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "rails", :github => "rails/rails", :branch => "4-2-stable"
gem "rails", "~> 4.2.0"

gemspec :path => "../"
gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_5.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source "https://rubygems.org"

gem "rails", "~> 5.0.0"

gemspec :path => "../"
gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_5.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source "https://rubygems.org"

gem "rails", "~> 5.1.0"

gemspec :path => "../"
gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_5.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source "https://rubygems.org"

gem "rails", "~> 5.2.0"

gemspec :path => "../"
gemspec path: "../"
17 changes: 16 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
ENV['RAILS_ENV'] = 'test'

require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
require 'invisible_captcha'

RSpec.configure do |config|
config.order = 'random'
config.order = :random
config.expect_with :rspec
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
end

# Rails 4.2 call `initialize` inside `recycle!`. However Ruby 2.6 doesn't allow calling `initialize` twice.
# More info: https://github.com/rails/rails/issues/34790
if RUBY_VERSION >= "2.6.0" && Rails.version < "5"
module ActionController
class TestResponse < ActionDispatch::TestResponse
def recycle!
@mon_mutex_owner_object_id = nil
@mon_mutex = nil
initialize
end
end
end
end

0 comments on commit 0494554

Please sign in to comment.