Commit 06630132d2da58b3cb00c40a02de8b627c260d09

Authored by Rafael Manzo
1 parent bc21a74d

rails_helper.rb or unit tests

Showing 41 changed files with 163 additions and 88 deletions   Show diff stats
.rspec
1 1 --color
  2 +--require spec_helper
... ...
spec/controllers/base_metric_configurations_controller_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 class CleanInheritsFromBaseMetricConfigurationsController < BaseMetricConfigurationsController
4 4 def metric_configuration; super; end
... ...
spec/controllers/compound_metric_configurations_controller_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe CompoundMetricConfigurationsController, :type => :controller do
4 4 let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) }
... ...
spec/controllers/concerns/metric_configurations_concern_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe MetricConfigurationsConcern, type: :controller do
4 4 describe 'set_metric_configuration' do
... ...
spec/controllers/concerns/ownership_authentication_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe OwnershipAuthentication, type: :controller do
4 4 #TODO: test other methods
... ...
spec/controllers/home_controller_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe HomeController, :type => :controller do
4 4 context 'Method' do
... ...
spec/controllers/metric_configurations_controller_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe MetricConfigurationsController, :type => :controller do
4 4 let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) }
... ...
spec/controllers/mezuro_configurations_controller_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe MezuroConfigurationsController, :type => :controller do
4 4  
... ...
spec/controllers/mezuro_ranges_controller_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe MezuroRangesController, :type => :controller do
4 4 let(:mezuro_range) { FactoryGirl.build(:mezuro_range, id: 1) }
... ...
spec/controllers/modules_controller_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe ModulesController, :type => :controller do
4 4 describe "load_module_tree" do
... ...
spec/controllers/projects_controller_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe ProjectsController, :type => :controller do
4 4  
... ...
spec/controllers/reading_groups_controller_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe ReadingGroupsController, :type => :controller do
4 4 describe 'new' do
... ...
spec/controllers/readings_controller_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe ReadingsController, :type => :controller do
4 4 let(:reading_group) { FactoryGirl.build(:reading_group) }
... ...
spec/controllers/repositories_controller_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe RepositoriesController, :type => :controller do
4 4 let(:project) { FactoryGirl.build(:project) }
... ...
spec/controllers/users_controller_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe UsersController, :type => :controller do
4 4 describe 'projects' do
... ...
spec/helpers/compound_metric_configurations_helper_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe CompoundMetricConfigurationsHelper, :type => :helper do
4 4 describe 'scope_options' do
... ...
spec/helpers/metric_configurations_helper_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe MetricConfigurationsHelper, :type => :helper do
4 4 describe 'aggregation_form_options' do
... ...
spec/helpers/mezuro_configurations_helper_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe MezuroConfigurationsHelper, :type => :helper do
4 4 describe 'mezuro_configuration_owner?' do
... ...
spec/helpers/mezuro_ranges_helper_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe MezuroRangesHelper, :type => :helper do
4 4 describe 'readings_options' do
... ...
spec/helpers/processings_helper_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe ProcessingsHelper, :type => :helper do
4 4 describe 'humanize_eplased_time' do
... ...
spec/helpers/projects_helper_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe ProjectsHelper, :type => :helper do
4 4  
... ...
spec/helpers/reading_groups_helper_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe ReadingGroupsHelper, :type => :helper do
4 4  
... ...
spec/helpers/repository_helper_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe RepositoryHelper, :type => :helper do
4 4  
... ...
spec/models/metric_configuration_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe MetricConfiguration, :type => :model do
4 4 subject {FactoryGirl.build(:metric_configuration)}
... ...
spec/models/mezuro_configuration_ownership_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe MezuroConfigurationOwnership, :type => :model do
4 4 describe 'associations' do
... ...
spec/models/mezuro_configuration_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe MezuroConfiguration, :type => :model do
4 4 subject { FactoryGirl.build(:mezuro_configuration) }
... ...
spec/models/mezuro_range_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe MezuroRange, :type => :model do
4 4 subject { FactoryGirl.build(:mezuro_range, { metric_configuration_id: 42 }) }
... ...
spec/models/module_result_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe ModuleResult, :type => :model do
4 4 describe 'methods' do
... ...
spec/models/processing_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe Processing, :type => :model do
4 4 describe 'methods' do
... ...
spec/models/project_ownership_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe ProjectOwnership, :type => :model do
4 4 describe 'associations' do
... ...
spec/models/project_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe Project, :type => :model do
4 4 describe 'methods' do
... ...
spec/models/reading_group_ownership_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe ReadingGroupOwnership, :type => :model do
4 4 describe 'associations' do
... ...
spec/models/reading_group_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe ReadingGroup, :type => :model do
4 4 describe 'methods' do
... ...
spec/models/reading_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe Reading, :type => :model do
4 4 describe 'validations' do
... ...
spec/models/repository_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe Repository, :type => :model do
4 4 describe 'methods' do
... ...
spec/models/user_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe User, :type => :model do
4 4 context 'validations' do
... ...
spec/models/validators/beginning_uniqueness_validator_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe BeginningUniquenessValidator, :type => :model do
4 4 describe 'methods' do
... ...
spec/models/validators/code_uniqueness_validator_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe CodeUniquenessValidator, :type => :model do
4 4 describe 'methods' do
... ...
spec/models/validators/kalibro_uniqueness_validator_spec.rb
1   -require 'spec_helper'
  1 +require 'rails_helper'
2 2  
3 3 describe KalibroUniquenessValidator, :type => :model do
4 4 describe 'methods' do
... ...
spec/rails_helper.rb 0 → 100644
... ... @@ -0,0 +1,67 @@
  1 +#Test coverage report
  2 +require 'simplecov'
  3 +require 'coveralls'
  4 +
  5 +SimpleCov.start do
  6 + formatter SimpleCov::Formatter::MultiFormatter[
  7 + Coveralls::SimpleCov::Formatter,
  8 + SimpleCov::Formatter::HTMLFormatter
  9 + ]
  10 + coverage_dir 'coverage/rspec'
  11 +
  12 + add_group "Models", "app/models"
  13 + add_group "Controllers", "app/controllers"
  14 + add_group "Helpers", "app/helpers"
  15 + add_group "Mailers", "app/mailers"
  16 +
  17 + add_filter "/spec/"
  18 + add_filter "/features/"
  19 + add_filter "/config/"
  20 +end
  21 +
  22 +# This file is copied to spec/ when you run 'rails generate rspec:install'
  23 +ENV["RAILS_ENV"] ||= 'test'
  24 +require 'spec_helper'
  25 +require File.expand_path("../../config/environment", __FILE__)
  26 +require 'rspec/rails'
  27 +
  28 +# Requires supporting ruby files with custom matchers and macros, etc, in
  29 +# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
  30 +# run as spec files by default. This means that files in spec/support that end
  31 +# in _spec.rb will both be required and run as specs, causing the specs to be
  32 +# run twice. It is recommended that you do not name files matching this glob to
  33 +# end with _spec.rb. You can configure this pattern with with the --pattern
  34 +# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
  35 +Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
  36 +
  37 +# Checks for pending migrations before tests are run.
  38 +# If you are not using ActiveRecord, you can remove this line.
  39 +ActiveRecord::Migration.maintain_test_schema!
  40 +
  41 +RSpec.configure do |config|
  42 + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  43 + config.fixture_path = "#{::Rails.root}/spec/fixtures"
  44 +
  45 + # If you're not using ActiveRecord, or you'd prefer not to run each of your
  46 + # examples within a transaction, remove the following line or assign false
  47 + # instead of true.
  48 + config.use_transactional_fixtures = true
  49 +
  50 + # RSpec Rails can automatically mix in different behaviours to your tests
  51 + # based on their file location, for example enabling you to call `get` and
  52 + # `post` in specs under `spec/controllers`.
  53 + #
  54 + # You can disable this behaviour by removing the line below, and instead
  55 + # explicitly tag your specs with their type, e.g.:
  56 + #
  57 + # RSpec.describe UsersController, :type => :controller do
  58 + # # ...
  59 + # end
  60 + #
  61 + # The different available types are documented in the features, such as in
  62 + # https://relishapp.com/rspec/rspec-rails/docs
  63 + config.infer_spec_type_from_file_location!
  64 +
  65 + # Devise helpers
  66 + config.include Devise::TestHelpers, :type => :controller
  67 +end
0 68 \ No newline at end of file
... ...
spec/spec_helper.rb
1   -#Test coverage report
2   -require 'simplecov'
3   -require 'coveralls'
4   -
5   -SimpleCov.start do
6   - formatter SimpleCov::Formatter::MultiFormatter[
7   - Coveralls::SimpleCov::Formatter,
8   - SimpleCov::Formatter::HTMLFormatter
9   - ]
10   - coverage_dir 'coverage/rspec'
11   -
12   - add_group "Models", "app/models"
13   - add_group "Controllers", "app/controllers"
14   - add_group "Helpers", "app/helpers"
15   - add_group "Mailers", "app/mailers"
16   -
17   - add_filter "/spec/"
18   - add_filter "/features/"
19   - add_filter "/config/"
20   -end
21   -
22   -# This file is copied to spec/ when you run 'rails generate rspec:install'
23   -ENV["RAILS_ENV"] ||= 'test'
24   -require File.expand_path("../../config/environment", __FILE__)
25   -require 'rspec/rails'
26   -require 'rspec/autorun'
27   -
28   -# Requires supporting ruby files with custom matchers and macros, etc,
29   -# in spec/support/ and its subdirectories.
30   -Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
31   -
  1 +# This file was generated by the `rails generate rspec:install` command. Conventionally, all
  2 +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
  3 +# The generated `.rspec` file contains `--require spec_helper` which will cause this
  4 +# file to always be loaded, without a need to explicitly require it in any files.
  5 +#
  6 +# Given that it is always loaded, you are encouraged to keep this file as
  7 +# light-weight as possible. Requiring heavyweight dependencies from this file
  8 +# will add to the boot time of your test suite on EVERY test run, even for an
  9 +# individual file that may not need all of that loaded. Instead, make a
  10 +# separate helper file that requires this one and then use it only in the specs
  11 +# that actually need it.
  12 +#
  13 +# The `.rspec` file also contains a few flags that are not defaults but that
  14 +# users commonly want.
  15 +#
  16 +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
32 17 RSpec.configure do |config|
33   - # ## Mock Framework
34   - #
35   - # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
36   - #
37   - config.mock_with :mocha
38   - # config.mock_with :flexmock
39   - # config.mock_with :rr
  18 +# The settings below are suggested to provide a good initial experience
  19 +# with RSpec, but feel free to customize to your heart's content.
40 20  
41   - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
42   - config.fixture_path = "#{::Rails.root}/spec/fixtures"
  21 + # These two settings work together to allow you to limit a spec run
  22 + # to individual examples or groups you care about by tagging them with
  23 + # `:focus` metadata. When nothing is tagged with `:focus`, all examples
  24 + # get run.
  25 + config.filter_run :focus
  26 + config.run_all_when_everything_filtered = true
43 27  
44   - # If you're not using ActiveRecord, or you'd prefer not to run each of your
45   - # examples within a transaction, remove the following line or assign false
46   - # instead of true.
47   - config.use_transactional_fixtures = true
  28 + # Many RSpec users commonly either run the entire suite or an individual
  29 + # file, and it's useful to allow more verbose output when running an
  30 + # individual spec file.
  31 + if config.files_to_run.one?
  32 + # Use the documentation formatter for detailed output,
  33 + # unless a formatter has already been configured
  34 + # (e.g. via a command-line flag).
  35 + config.default_formatter = 'doc'
  36 + end
48 37  
49   - # If true, the base class of anonymous controllers will be inferred
50   - # automatically. This will be the default behavior in future versions of
51   - # rspec-rails.
52   - config.infer_base_class_for_anonymous_controllers = false
  38 + # Print the 10 slowest examples and example groups at the
  39 + # end of the spec run, to help surface which specs are running
  40 + # particularly slow.
  41 + config.profile_examples = 10
53 42  
54 43 # Run specs in random order to surface order dependencies. If you find an
55 44 # order dependency and want to debug it, you can fix the order by providing
56 45 # the seed, which is printed after each run.
57 46 # --seed 1234
58   - config.order = "random"
  47 + config.order = :random
  48 +
  49 + # Seed global randomization in this process using the `--seed` CLI option.
  50 + # Setting this allows you to use `--seed` to deterministically reproduce
  51 + # test failures related to randomization by passing the same `--seed` value
  52 + # as the one that triggered the failure.
  53 + Kernel.srand config.seed
59 54  
60   - config.include Devise::TestHelpers, :type => :controller
  55 + # rspec-expectations config goes here. You can use an alternate
  56 + # assertion/expectation library such as wrong or the stdlib/minitest
  57 + # assertions if you prefer.
  58 + config.expect_with :rspec do |expectations|
  59 + # Enable only the newer, non-monkey-patching expect syntax.
  60 + # For more details, see:
  61 + # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
  62 + expectations.syntax = :expect
  63 + end
  64 +
  65 + # rspec-mocks config goes here. You can use an alternate test double
  66 + # library (such as bogus or mocha) by changing the `mock_with` option here.
  67 + config.mock_with :mocha
61 68 end
... ...