diff --git a/.rspec b/.rspec index 4e1e0d2..83e16f8 100644 --- a/.rspec +++ b/.rspec @@ -1 +1,2 @@ --color +--require spec_helper diff --git a/spec/controllers/base_metric_configurations_controller_spec.rb b/spec/controllers/base_metric_configurations_controller_spec.rb index 5e54e8a..882ff89 100644 --- a/spec/controllers/base_metric_configurations_controller_spec.rb +++ b/spec/controllers/base_metric_configurations_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' class CleanInheritsFromBaseMetricConfigurationsController < BaseMetricConfigurationsController def metric_configuration; super; end diff --git a/spec/controllers/compound_metric_configurations_controller_spec.rb b/spec/controllers/compound_metric_configurations_controller_spec.rb index 060156e..3a15068 100644 --- a/spec/controllers/compound_metric_configurations_controller_spec.rb +++ b/spec/controllers/compound_metric_configurations_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe CompoundMetricConfigurationsController, :type => :controller do let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } diff --git a/spec/controllers/concerns/metric_configurations_concern_spec.rb b/spec/controllers/concerns/metric_configurations_concern_spec.rb index cf3a2a5..edef7ae 100644 --- a/spec/controllers/concerns/metric_configurations_concern_spec.rb +++ b/spec/controllers/concerns/metric_configurations_concern_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe MetricConfigurationsConcern, type: :controller do describe 'set_metric_configuration' do diff --git a/spec/controllers/concerns/ownership_authentication_spec.rb b/spec/controllers/concerns/ownership_authentication_spec.rb index ec8c412..1aec850 100644 --- a/spec/controllers/concerns/ownership_authentication_spec.rb +++ b/spec/controllers/concerns/ownership_authentication_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe OwnershipAuthentication, type: :controller do #TODO: test other methods diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index f14c387..46904cb 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe HomeController, :type => :controller do context 'Method' do diff --git a/spec/controllers/metric_configurations_controller_spec.rb b/spec/controllers/metric_configurations_controller_spec.rb index c5bd877..776fdd4 100644 --- a/spec/controllers/metric_configurations_controller_spec.rb +++ b/spec/controllers/metric_configurations_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe MetricConfigurationsController, :type => :controller do let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } diff --git a/spec/controllers/mezuro_configurations_controller_spec.rb b/spec/controllers/mezuro_configurations_controller_spec.rb index 54f1bb3..aa45b66 100644 --- a/spec/controllers/mezuro_configurations_controller_spec.rb +++ b/spec/controllers/mezuro_configurations_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe MezuroConfigurationsController, :type => :controller do diff --git a/spec/controllers/mezuro_ranges_controller_spec.rb b/spec/controllers/mezuro_ranges_controller_spec.rb index 3a4cd75..550ed8b 100644 --- a/spec/controllers/mezuro_ranges_controller_spec.rb +++ b/spec/controllers/mezuro_ranges_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe MezuroRangesController, :type => :controller do let(:mezuro_range) { FactoryGirl.build(:mezuro_range, id: 1) } diff --git a/spec/controllers/modules_controller_spec.rb b/spec/controllers/modules_controller_spec.rb index 6ba9270..5ea7286 100644 --- a/spec/controllers/modules_controller_spec.rb +++ b/spec/controllers/modules_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe ModulesController, :type => :controller do describe "load_module_tree" do diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index ab97557..68af865 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe ProjectsController, :type => :controller do diff --git a/spec/controllers/reading_groups_controller_spec.rb b/spec/controllers/reading_groups_controller_spec.rb index 1f57fd3..9cc7779 100644 --- a/spec/controllers/reading_groups_controller_spec.rb +++ b/spec/controllers/reading_groups_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe ReadingGroupsController, :type => :controller do describe 'new' do diff --git a/spec/controllers/readings_controller_spec.rb b/spec/controllers/readings_controller_spec.rb index e9d532c..0e94269 100644 --- a/spec/controllers/readings_controller_spec.rb +++ b/spec/controllers/readings_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe ReadingsController, :type => :controller do let(:reading_group) { FactoryGirl.build(:reading_group) } diff --git a/spec/controllers/repositories_controller_spec.rb b/spec/controllers/repositories_controller_spec.rb index df50ff7..6bccfb1 100644 --- a/spec/controllers/repositories_controller_spec.rb +++ b/spec/controllers/repositories_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe RepositoriesController, :type => :controller do let(:project) { FactoryGirl.build(:project) } diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 74e2583..189d8e1 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe UsersController, :type => :controller do describe 'projects' do diff --git a/spec/helpers/compound_metric_configurations_helper_spec.rb b/spec/helpers/compound_metric_configurations_helper_spec.rb index 7576718..045732d 100644 --- a/spec/helpers/compound_metric_configurations_helper_spec.rb +++ b/spec/helpers/compound_metric_configurations_helper_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe CompoundMetricConfigurationsHelper, :type => :helper do describe 'scope_options' do diff --git a/spec/helpers/metric_configurations_helper_spec.rb b/spec/helpers/metric_configurations_helper_spec.rb index 83b2515..c4757cd 100644 --- a/spec/helpers/metric_configurations_helper_spec.rb +++ b/spec/helpers/metric_configurations_helper_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe MetricConfigurationsHelper, :type => :helper do describe 'aggregation_form_options' do diff --git a/spec/helpers/mezuro_configurations_helper_spec.rb b/spec/helpers/mezuro_configurations_helper_spec.rb index 3edab6a..292ecf8 100644 --- a/spec/helpers/mezuro_configurations_helper_spec.rb +++ b/spec/helpers/mezuro_configurations_helper_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe MezuroConfigurationsHelper, :type => :helper do describe 'mezuro_configuration_owner?' do diff --git a/spec/helpers/mezuro_ranges_helper_spec.rb b/spec/helpers/mezuro_ranges_helper_spec.rb index 120be41..8b4cf1f 100644 --- a/spec/helpers/mezuro_ranges_helper_spec.rb +++ b/spec/helpers/mezuro_ranges_helper_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe MezuroRangesHelper, :type => :helper do describe 'readings_options' do diff --git a/spec/helpers/processings_helper_spec.rb b/spec/helpers/processings_helper_spec.rb index 03ce238..d2c12d8 100644 --- a/spec/helpers/processings_helper_spec.rb +++ b/spec/helpers/processings_helper_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe ProcessingsHelper, :type => :helper do describe 'humanize_eplased_time' do diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index ee84051..8f8d15a 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe ProjectsHelper, :type => :helper do diff --git a/spec/helpers/reading_groups_helper_spec.rb b/spec/helpers/reading_groups_helper_spec.rb index 7c460a8..3ee7532 100644 --- a/spec/helpers/reading_groups_helper_spec.rb +++ b/spec/helpers/reading_groups_helper_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe ReadingGroupsHelper, :type => :helper do diff --git a/spec/helpers/repository_helper_spec.rb b/spec/helpers/repository_helper_spec.rb index 389564b..c7f02d9 100644 --- a/spec/helpers/repository_helper_spec.rb +++ b/spec/helpers/repository_helper_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe RepositoryHelper, :type => :helper do diff --git a/spec/models/metric_configuration_spec.rb b/spec/models/metric_configuration_spec.rb index 01bbff4..9ddfcdc 100644 --- a/spec/models/metric_configuration_spec.rb +++ b/spec/models/metric_configuration_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe MetricConfiguration, :type => :model do subject {FactoryGirl.build(:metric_configuration)} diff --git a/spec/models/mezuro_configuration_ownership_spec.rb b/spec/models/mezuro_configuration_ownership_spec.rb index 1c63d22..70013c2 100644 --- a/spec/models/mezuro_configuration_ownership_spec.rb +++ b/spec/models/mezuro_configuration_ownership_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe MezuroConfigurationOwnership, :type => :model do describe 'associations' do diff --git a/spec/models/mezuro_configuration_spec.rb b/spec/models/mezuro_configuration_spec.rb index bbd3c4c..514e63d 100644 --- a/spec/models/mezuro_configuration_spec.rb +++ b/spec/models/mezuro_configuration_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe MezuroConfiguration, :type => :model do subject { FactoryGirl.build(:mezuro_configuration) } diff --git a/spec/models/mezuro_range_spec.rb b/spec/models/mezuro_range_spec.rb index d9cf102..1effe9a 100644 --- a/spec/models/mezuro_range_spec.rb +++ b/spec/models/mezuro_range_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe MezuroRange, :type => :model do subject { FactoryGirl.build(:mezuro_range, { metric_configuration_id: 42 }) } diff --git a/spec/models/module_result_spec.rb b/spec/models/module_result_spec.rb index 1eef95d..92e99a9 100644 --- a/spec/models/module_result_spec.rb +++ b/spec/models/module_result_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe ModuleResult, :type => :model do describe 'methods' do diff --git a/spec/models/processing_spec.rb b/spec/models/processing_spec.rb index 0295e9b..7babf98 100644 --- a/spec/models/processing_spec.rb +++ b/spec/models/processing_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe Processing, :type => :model do describe 'methods' do diff --git a/spec/models/project_ownership_spec.rb b/spec/models/project_ownership_spec.rb index 1fc2bf8..1b87df3 100644 --- a/spec/models/project_ownership_spec.rb +++ b/spec/models/project_ownership_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe ProjectOwnership, :type => :model do describe 'associations' do diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 9d99f79..0f5938c 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe Project, :type => :model do describe 'methods' do diff --git a/spec/models/reading_group_ownership_spec.rb b/spec/models/reading_group_ownership_spec.rb index 3cba3fa..ff2c3ee 100644 --- a/spec/models/reading_group_ownership_spec.rb +++ b/spec/models/reading_group_ownership_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe ReadingGroupOwnership, :type => :model do describe 'associations' do diff --git a/spec/models/reading_group_spec.rb b/spec/models/reading_group_spec.rb index f3f29ba..82b8588 100644 --- a/spec/models/reading_group_spec.rb +++ b/spec/models/reading_group_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe ReadingGroup, :type => :model do describe 'methods' do diff --git a/spec/models/reading_spec.rb b/spec/models/reading_spec.rb index 00ae9c2..65b9efd 100644 --- a/spec/models/reading_spec.rb +++ b/spec/models/reading_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe Reading, :type => :model do describe 'validations' do diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index ba5699a..306403d 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe Repository, :type => :model do describe 'methods' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index a43dd6a..0d4cbd3 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe User, :type => :model do context 'validations' do diff --git a/spec/models/validators/beginning_uniqueness_validator_spec.rb b/spec/models/validators/beginning_uniqueness_validator_spec.rb index 8c9cd22..41967c3 100644 --- a/spec/models/validators/beginning_uniqueness_validator_spec.rb +++ b/spec/models/validators/beginning_uniqueness_validator_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe BeginningUniquenessValidator, :type => :model do describe 'methods' do diff --git a/spec/models/validators/code_uniqueness_validator_spec.rb b/spec/models/validators/code_uniqueness_validator_spec.rb index 167b271..a5e1f94 100644 --- a/spec/models/validators/code_uniqueness_validator_spec.rb +++ b/spec/models/validators/code_uniqueness_validator_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe CodeUniquenessValidator, :type => :model do describe 'methods' do diff --git a/spec/models/validators/kalibro_uniqueness_validator_spec.rb b/spec/models/validators/kalibro_uniqueness_validator_spec.rb index d78cce1..f821982 100644 --- a/spec/models/validators/kalibro_uniqueness_validator_spec.rb +++ b/spec/models/validators/kalibro_uniqueness_validator_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe KalibroUniquenessValidator, :type => :model do describe 'methods' do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb new file mode 100644 index 0000000..c42ad4a --- /dev/null +++ b/spec/rails_helper.rb @@ -0,0 +1,67 @@ +#Test coverage report +require 'simplecov' +require 'coveralls' + +SimpleCov.start do + formatter SimpleCov::Formatter::MultiFormatter[ + Coveralls::SimpleCov::Formatter, + SimpleCov::Formatter::HTMLFormatter + ] + coverage_dir 'coverage/rspec' + + add_group "Models", "app/models" + add_group "Controllers", "app/controllers" + add_group "Helpers", "app/helpers" + add_group "Mailers", "app/mailers" + + add_filter "/spec/" + add_filter "/features/" + add_filter "/config/" +end + +# This file is copied to spec/ when you run 'rails generate rspec:install' +ENV["RAILS_ENV"] ||= 'test' +require 'spec_helper' +require File.expand_path("../../config/environment", __FILE__) +require 'rspec/rails' + +# Requires supporting ruby files with custom matchers and macros, etc, in +# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are +# run as spec files by default. This means that files in spec/support that end +# in _spec.rb will both be required and run as specs, causing the specs to be +# run twice. It is recommended that you do not name files matching this glob to +# end with _spec.rb. You can configure this pattern with with the --pattern +# option on the command line or in ~/.rspec, .rspec or `.rspec-local`. +Dir[Rails.root.join("spec/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! + +RSpec.configure do |config| + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + config.fixture_path = "#{::Rails.root}/spec/fixtures" + + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, remove the following line or assign false + # instead of true. + config.use_transactional_fixtures = true + + # RSpec Rails can automatically mix in different behaviours to your tests + # based on their file location, for example enabling you to call `get` and + # `post` in specs under `spec/controllers`. + # + # You can disable this behaviour by removing the line below, and instead + # explicitly tag your specs with their type, e.g.: + # + # RSpec.describe UsersController, :type => :controller do + # # ... + # end + # + # The different available types are documented in the features, such as in + # https://relishapp.com/rspec/rspec-rails/docs + config.infer_spec_type_from_file_location! + + # Devise helpers + config.include Devise::TestHelpers, :type => :controller +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c05c70d..6413fa7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,61 +1,68 @@ -#Test coverage report -require 'simplecov' -require 'coveralls' - -SimpleCov.start do - formatter SimpleCov::Formatter::MultiFormatter[ - Coveralls::SimpleCov::Formatter, - SimpleCov::Formatter::HTMLFormatter - ] - coverage_dir 'coverage/rspec' - - add_group "Models", "app/models" - add_group "Controllers", "app/controllers" - add_group "Helpers", "app/helpers" - add_group "Mailers", "app/mailers" - - add_filter "/spec/" - add_filter "/features/" - add_filter "/config/" -end - -# This file is copied to spec/ when you run 'rails generate rspec:install' -ENV["RAILS_ENV"] ||= 'test' -require File.expand_path("../../config/environment", __FILE__) -require 'rspec/rails' -require 'rspec/autorun' - -# Requires supporting ruby files with custom matchers and macros, etc, -# in spec/support/ and its subdirectories. -Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } - +# 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, make a +# separate helper file that requires this one and then use it only in the specs +# 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| - # ## Mock Framework - # - # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: - # - config.mock_with :mocha - # config.mock_with :flexmock - # config.mock_with :rr +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" + # These two settings work together to allow 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. + config.filter_run :focus + config.run_all_when_everything_filtered = true - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, remove the following line or assign false - # instead of true. - config.use_transactional_fixtures = true + # 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 - # 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 + # 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" + config.order = :random + + # 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 - config.include Devise::TestHelpers, :type => :controller + # 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| + # Enable only the newer, non-monkey-patching expect syntax. + # For more details, see: + # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax + expectations.syntax = :expect + 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 :mocha end -- libgit2 0.21.2