diff --git a/.simplecov b/.simplecov new file mode 100644 index 0000000..76632f6 --- /dev/null +++ b/.simplecov @@ -0,0 +1,4 @@ +SimpleCov.formatter = Coveralls::SimpleCov::Formatter +SimpleCov.start 'rails' do + add_filter "/gemfiles/vendor" +end \ No newline at end of file diff --git a/Rakefile b/Rakefile index 267b276..dd5b8e9 100644 --- a/Rakefile +++ b/Rakefile @@ -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' + diff --git a/db/schema.rb b/db/schema.rb index c60784e..4e0f26c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" @@ -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 diff --git a/features/support/env.rb b/features/support/env.rb index a2530b1..be7c8b0 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -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' diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index ed131a2..5b71e9a 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -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 diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 8d4ce5e..2881bd1 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -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' diff --git a/spec/requests/api/v1/users_spec.rb b/spec/requests/api/v1/users_spec.rb index 718d245..9eb52c6 100644 --- a/spec/requests/api/v1/users_spec.rb +++ b/spec/requests/api/v1/users_spec.rb @@ -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) } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 340fa6e..0d6c9f1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,4 @@ + RSpec.configure do |config| config.expect_with :rspec do |expectations|