Skip to content

Commit

Permalink
RUBY-1742 Add Rails 5.1 environment for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mwear committed May 12, 2017
1 parent 6b52a25 commit 8ec2e6d
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/environments/rails51/Gemfile
@@ -0,0 +1,23 @@
source 'https://rubygems.org'

gem 'rake', '< 11'

gem 'rails', '5.1.0'

gem 'minitest', '5.2.3'
gem 'mocha', '1.1', :require => false
gem 'rack'
gem 'rack-test'

platforms :jruby do
gem "jruby-openssl"
end

platforms :ruby do
gem "mysql2"
end

gem "newrelic_rpm", :path => "../../.."

gem 'pry', '~> 0.9.12'
gem 'hometown', '~> 0.2.5'
11 changes: 11 additions & 0 deletions test/environments/rails51/Rakefile
@@ -0,0 +1,11 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require 'rake'

RpmTestApp::Application.load_tasks
require 'tasks/all'

Rake::Task["default"].clear
task :default => [:'test:newrelic']
18 changes: 18 additions & 0 deletions test/environments/rails51/config/application.rb
@@ -0,0 +1,18 @@
# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require File.expand_path('../boot', __FILE__)

require 'rails/all'

Bundler.require(:default, Rails.env) if defined?(Bundler)

module RpmTestApp
class Application < Rails::Application
config.encoding = "utf-8"
config.filter_parameters += [:password]
config.secret_key_base = '414fd9af0cc192729b2b6bffe9e7077c9ac8eed5cbb74c8c4cd628906b716770598a2b7e1f328052753a4df72e559969dc05b408de73ce040c93cac7c51a348e'
config.eager_load = false
end
end
10 changes: 10 additions & 0 deletions test/environments/rails51/config/boot.rb
@@ -0,0 +1,10 @@
# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require 'rubygems'

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
26 changes: 26 additions & 0 deletions test/environments/rails51/config/database.yml
@@ -0,0 +1,26 @@
mysql: &mysql
adapter: mysql2
socket: <%= (`uname -s` =~ /Linux/ ) ? "" : "/tmp/mysql.sock" %>
username: root
host: localhost
database: <%= db = "#{ENV['RUBY_VERSION']}#{ENV['BRANCH']}"; db.empty? ? "rails_blog" : db %>

sqlite3: &sqlite3
<% if defined?(JRuby) %>
adapter: jdbcsqlite3
<% else %>
adapter: sqlite3
<% end %>
database: db/all.sqlite3
pool: 5
timeout: 5000
host: localhost

development:
<<: *sqlite3

test:
<<: *mysql

production:
<<: *mysql
6 changes: 6 additions & 0 deletions test/environments/rails51/config/environment.rb
@@ -0,0 +1,6 @@
# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require File.expand_path('../application', __FILE__)
RpmTestApp::Application.initialize!
5 changes: 5 additions & 0 deletions test/environments/rails51/db/schema.rb
@@ -0,0 +1,5 @@
# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

# File is required to exist by Rails

0 comments on commit 8ec2e6d

Please sign in to comment.