Skip to content

Commit

Permalink
Update to test against Rails 5
Browse files Browse the repository at this point in the history
Also updated Travis config.
  • Loading branch information
wbyoung committed Aug 1, 2016
1 parent 47e82f7 commit 387f2be
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 37 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
script: xvfb-run rake
language: ruby
sudo: false
rvm:
- 1.9.3
- 2.0.0
- 2.2.2
- 2.3.0
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Leña [![Gem Version](https://badge.fury.io/rb/lena.png)](http://badge.fury.io/rb/lena) [![Build Status](https://secure.travis-ci.org/wbyoung/lena.png)](http://travis-ci.org/wbyoung/lena) [![Code Review](https://codeclimate.com/github/wbyoung/lena.png)](https://codeclimate.com/github/wbyoung/lena) [![Code Coverage](https://coveralls.io/repos/wbyoung/lena/badge.png)](https://coveralls.io/r/wbyoung/lena)
# Leña
[![Gem Version][gem-image]][gem-url]
[![Build status][travis-image]][travis-url]
[![Code Climate][codeclimate-image]][codeclimate-url]
[![Coverage Status][coverage-image]][coverage-url]

Leña generates reports of client-side JavaScript errors in production Rails applications by sending error details to the server. This allows for better tracking of errors that occur in front-end code.

Expand Down Expand Up @@ -72,4 +76,13 @@ The following options are available:

## License

This project is distributed under the MIT license.
This project is distributed under the MIT license.

[travis-image]: http://img.shields.io/travis/wbyoung/lena.svg?style=flat
[travis-url]: http://travis-ci.org/wbyoung/lena
[gem-image]: http://img.shields.io/gem/v/azul.svg?style=flat
[gem-url]: https://rubygems.org/gems/lena
[codeclimate-image]: http://img.shields.io/codeclimate/github/wbyoung/lena.svg?style=flat
[codeclimate-url]: https://codeclimate.com/github/wbyoung/lena
[coverage-image]: http://img.shields.io/coveralls/wbyoung/lena.svg?style=flat
[coverage-url]: https://coveralls.io/r/wbyoung/lena
2 changes: 1 addition & 1 deletion spec/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
config.cache_classes = true
config.eager_load = false
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_dispatch.show_exceptions = false
Expand Down
2 changes: 1 addition & 1 deletion spec/features/lena_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

describe 'lena test app' do

Expand Down
38 changes: 38 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../dummy/config/environment", __FILE__)
require 'spec_helper'
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara-webkit'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("../support/**/*.rb")].each { |f| require f }

# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema! if defined?(ActiveRecord::Migration)

RSpec.configure do |config|
config.infer_spec_type_from_file_location!

# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false

# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"

# Using webkit as the javascript driver
Capybara.javascript_driver = :webkit

# Support use of expect_it one-liners allowing use of `expect_it { to ... }`
# syntax when should has been disabled.
config.alias_example_to :expect_it
end
123 changes: 92 additions & 31 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,110 @@
# Enable Coveralls
Coveralls.wear!

# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../dummy/config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara-webkit'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("../support/**/*.rb")].each { |f| require f }

# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)

# Support use of to and to_not in one-liners allowing use of `expect_it { to ... }`
# syntax when should has been disabled.
RSpec::Core::MemoizedHelpers.module_eval do
alias to should
alias to_not should_not
end

# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, consider making
# a separate helper file that requires the additional dependencies and performs
# the additional setup, and require it from the spec files that actually need
# it.
#
# The `.rspec` file also contains a few flags that are not defaults but that
# users commonly want.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
expectations.syntax = :expect # Disable should syntax.
end

# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end

# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
# have no way to turn it off -- the option exists only for backwards
# compatibility in RSpec 3). It causes shared context metadata to be
# inherited by the metadata hash of host groups and examples, rather than
# triggering implicit auto-inclusion in groups with matching metadata.
config.shared_context_metadata_behavior = :apply_to_host_groups

# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
=begin
# This allows you to limit a spec run to individual examples or groups
# you care about by tagging them with `:focus` metadata. When nothing
# is tagged with `:focus`, all examples get run. RSpec also provides
# aliases for `it`, `describe`, and `context` that include `:focus`
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
config.filter_run_when_matching :focus
# Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. We recommend
# you configure your source control system to ignore this file.
config.example_status_persistence_file_path = "spec/examples.txt"
# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
config.disable_monkey_patching!
# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = 'doc'
end
# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"

# Using webkit as the javascript driver
Capybara.javascript_driver = :webkit

# Disable should syntax.
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.order = :random
# Support use of expect_it one-liners allowing use of `expect_it { to ... }`
# syntax when should has been disabled.
config.alias_example_to :expect_it
# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
=end
end

0 comments on commit 387f2be

Please sign in to comment.