Skip to content

Commit

Permalink
#114553545 Merging Coverall Test Results
Browse files Browse the repository at this point in the history
* Rakefile task added, .simplecov for options added, modified env.rb and rails_helper.rb

* trying to get rspec tests to coverage

* SimpleCov + Coverall setup for merging the test results
  • Loading branch information
fighterii authored and Thomas Ochman committed Apr 4, 2016
1 parent ae18c53 commit 6260263
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
SimpleCov.start 'rails' do
add_filter "/gemfiles/vendor"
end
4 changes: 4 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

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

require 'coveralls/rake/task'
Coveralls::RakeTask.new
task :test_with_coveralls => [:spec,:cucumber, 'coveralls:push']
Rails.application.load_tasks

task default: 'brakeman:run'
task default: 'bundler:audit'


2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@
t.inet "last_sign_in_ip"
t.boolean "mentor", default: false
t.boolean "private", default: false
t.string "slug"
t.string "authentication_token"
t.string "provider"
t.string "uid"
Expand All @@ -152,6 +151,7 @@
t.string "gender"
t.inet "ip_address"
t.string "introduction"
t.string "slug"
end

add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", using: :btree
Expand Down
4 changes: 3 additions & 1 deletion features/support/env.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
require 'coveralls'
Coveralls.wear!
require 'simplecov'
SimpleCov.command_name "features"
Coveralls.wear_merged!('rails')
require 'rack/test'
require 'cucumber/rails'
require 'capybara/poltergeist'
Expand Down
4 changes: 3 additions & 1 deletion spec/models/user_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
require 'rails_helper'

#its important for SimpleCov in order to merge the test results correctly
#that in one file of each test folder we specify a command_name
SimpleCov.command_name 'test:units'
RSpec.describe User, type: :model do

it 'should be of class User' do
Expand Down
5 changes: 3 additions & 2 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
ENV['RAILS_ENV'] ||= 'test'
require 'coveralls'
Coveralls.wear!
require 'simplecov'
Coveralls.wear_merged!('rails')
require 'spec_helper'
require File.expand_path('../../config/environment', __FILE__)
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
abort('The Rails environment is running in production mode!') if Rails.env.production?
require 'spec_helper'
require 'rspec/rails'
require 'webmock/rspec'
require 'vcr'
Expand Down
3 changes: 3 additions & 0 deletions spec/requests/api/v1/users_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
require 'rails_helper'
#its important for SimpleCov in order to merge the test results correctly
#that in one file of each test folder we specify a command_name
SimpleCov.command_name 'test:functionals'

describe Api::V1::UsersController do
let(:user) { FactoryGirl.create(:user) }
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

RSpec.configure do |config|

config.expect_with :rspec do |expectations|
Expand Down

0 comments on commit 6260263

Please sign in to comment.