Merge pull request #41 from SuperTux88/ruby-2.1-rails-4.2
Activate ruby 2.1 with rails 4.2 on travis again
This commit is contained in:
commit
4671ed9fd4
9 changed files with 77 additions and 5 deletions
|
|
@ -183,3 +183,7 @@ Style/NumericPredicate:
|
||||||
|
|
||||||
Style/FrozenStringLiteralComment:
|
Style/FrozenStringLiteralComment:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Rails/HttpPositionalArguments:
|
||||||
|
Exclude:
|
||||||
|
- "spec/controllers/diaspora_federation/fixtures_rails4_spec.rb"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ language: ruby
|
||||||
rvm:
|
rvm:
|
||||||
- 2.3.1
|
- 2.3.1
|
||||||
- 2.2.5
|
- 2.2.5
|
||||||
|
- 2.1
|
||||||
|
|
||||||
sudo: false
|
sudo: false
|
||||||
cache:
|
cache:
|
||||||
|
|
@ -13,7 +14,7 @@ branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
- 'develop'
|
- 'develop'
|
||||||
|
|
||||||
before_install: gem install bundler
|
before_install: test/scripts/prepare-travis.sh
|
||||||
bundler_args: "--deployment --without development --jobs=3 --retry=3"
|
bundler_args: "--deployment --without development --jobs=3 --retry=3"
|
||||||
|
|
||||||
script: bundle exec rake --trace
|
script: test/scripts/travis.sh
|
||||||
|
|
|
||||||
15
lib/tasks/rails4.rake
Normal file
15
lib/tasks/rails4.rake
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
if defined?(RSpec)
|
||||||
|
namespace :rails4 do
|
||||||
|
desc "Run all specs that generate fixtures for rspec with rails 4"
|
||||||
|
RSpec::Core::RakeTask.new(:generate_fixtures) do |t|
|
||||||
|
t.rspec_opts = ["--tag fixture4"]
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Run all specs in spec directory (exluding controller specs)"
|
||||||
|
RSpec::Core::RakeTask.new(:spec) do |task|
|
||||||
|
task.pattern = FileList["spec/**/*_spec.rb"].exclude("spec/controllers/**/*_spec.rb")
|
||||||
|
end
|
||||||
|
|
||||||
|
task test: %w(spec:prepare_db generate_fixtures spec)
|
||||||
|
end
|
||||||
|
end
|
||||||
21
spec/controllers/diaspora_federation/fixtures_rails4_spec.rb
Normal file
21
spec/controllers/diaspora_federation/fixtures_rails4_spec.rb
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
module DiasporaFederation
|
||||||
|
describe WebfingerController, type: :controller do
|
||||||
|
routes { DiasporaFederation::Engine.routes }
|
||||||
|
|
||||||
|
it "generates webfinger fixture", fixture4: true, rails4: true do
|
||||||
|
get :legacy_webfinger, q: "alice@localhost:3000"
|
||||||
|
expect(response).to be_success
|
||||||
|
save_fixture(response.body, "legacy-webfinger")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe HCardController, type: :controller do
|
||||||
|
routes { DiasporaFederation::Engine.routes }
|
||||||
|
|
||||||
|
it "generates hcard fixture", fixture4: true, rails4: true do
|
||||||
|
get :hcard, guid: alice.guid
|
||||||
|
expect(response).to be_success
|
||||||
|
save_fixture(response.body, "hcard")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -8,7 +8,7 @@ module DiasporaFederation
|
||||||
WebfingerController.instance_variable_set(:@host_meta_xml, nil) # clear cache
|
WebfingerController.instance_variable_set(:@host_meta_xml, nil) # clear cache
|
||||||
end
|
end
|
||||||
|
|
||||||
it "succeeds", fixture: true do
|
it "succeeds", fixture: true, fixture4: true do
|
||||||
get :host_meta
|
get :host_meta
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
save_fixture(response.body, "host-meta")
|
save_fixture(response.body, "host-meta")
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,8 @@ RSpec.configure do |config|
|
||||||
config.fixture_path = "#{::Rails.root}/test/fixtures"
|
config.fixture_path = "#{::Rails.root}/test/fixtures"
|
||||||
config.global_fixtures = :all
|
config.global_fixtures = :all
|
||||||
|
|
||||||
|
config.filter_run_excluding rails4: true if Rails::VERSION::MAJOR == 5
|
||||||
|
|
||||||
# whitelist codeclimate.com so test coverage can be reported
|
# whitelist codeclimate.com so test coverage can be reported
|
||||||
config.after(:suite) do
|
config.after(:suite) do
|
||||||
WebMock.disable_net_connect!(allow: "codeclimate.com")
|
WebMock.disable_net_connect!(allow: "codeclimate.com")
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,13 @@ Rails.application.configure do
|
||||||
config.eager_load = false
|
config.eager_load = false
|
||||||
|
|
||||||
# Configure static file server for tests with Cache-Control for performance.
|
# Configure static file server for tests with Cache-Control for performance.
|
||||||
config.public_file_server.enable = true
|
if Rails::VERSION::MAJOR == 5
|
||||||
config.public_file_server.headers = {"Cache-Control" => "public, max-age=3600"}
|
config.public_file_server.enable = true
|
||||||
|
config.public_file_server.headers = {"Cache-Control" => "public, max-age=3600"}
|
||||||
|
else
|
||||||
|
config.serve_static_files = true
|
||||||
|
config.static_cache_control = "public, max-age=3600"
|
||||||
|
end
|
||||||
|
|
||||||
# Show full error reports and disable caching.
|
# Show full error reports and disable caching.
|
||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
|
|
|
||||||
12
test/scripts/prepare-travis.sh
Executable file
12
test/scripts/prepare-travis.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
gem install bundler
|
||||||
|
|
||||||
|
if [[ ${TRAVIS_RUBY_VERSION} == "2.1" ]]; then
|
||||||
|
# use rails 4 for ruby 2.1, because rails 5 needs ruby >= 2.2.2
|
||||||
|
echo "gem 'rails', '4.2.7.1'" >> Gemfile
|
||||||
|
bundle install --without development --jobs=3 --retry=3
|
||||||
|
bundle update rails
|
||||||
|
fi
|
||||||
12
test/scripts/travis.sh
Executable file
12
test/scripts/travis.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if [[ ${TRAVIS_RUBY_VERSION} == "2.1" ]]; then
|
||||||
|
# ruby 2.1
|
||||||
|
export NO_COVERAGE="true" # No coverage for rails 4, because controller specs are disabled
|
||||||
|
bundle exec rake rails4:test --trace
|
||||||
|
else
|
||||||
|
# ruby >= 2.2
|
||||||
|
bundle exec rake --trace
|
||||||
|
fi
|
||||||
Loading…
Reference in a new issue