Browse Source

Add simplecov for test coverage.

1-2-stable-sysmocom
Jeff Dutil 9 years ago
parent
commit
9a2234d113
  1. 5
      .gitignore
  2. 37
      spec/spec_helper.rb
  3. 5
      spree_paypal_express.gemspec

5
.gitignore

@ -1,8 +1,9 @@
*.swp
.DS_store
spec/test_app
spec/dummy
.rvmrc
.sass-cache
.bundle
coverage
Gemfile.lock
spec/test_app
spec/dummy

37
spec/spec_helper.rb

@ -1,38 +1,45 @@
# Setup simplecov first to make sure coverage happens through everything.
require 'simplecov'
SimpleCov.start do
add_filter '/config/'
add_group 'Controllers', 'app/controllers'
add_group 'Helpers', 'app/helpers'
add_group 'Mailers', 'app/mailers'
add_group 'Models', 'app/models'
add_group 'Libraries', 'lib'
add_group 'Specs', 'spec'
end
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../dummy/config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
require 'factory_girl'
FactoryGirl.find_definitions
require 'ffaker'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f }
#include spree's factories
# Requires factories defined in spree_core
require 'spree/core/testing_support/factories'
require 'spree/core/testing_support/fixtures'
# include local factories
Dir["#{File.dirname(__FILE__)}/factories/**/*.rb"].each do |f|
fp = File.expand_path(f)
require fp
end
require 'ffaker'
require 'spree/core/testing_support/authorization_helpers'
require 'spree/core/url_helpers'
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.include Spree::Core::UrlHelpers
config.color = true
config.mock_with :rspec
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
config.include Spree::UrlHelpers
end
Spree::Zone.class_eval do
def self.global
find_by_name("GlobalZone") || Factory(:global_zone)
find_by_name("GlobalZone") || FactoryGirl.create(:global_zone)
end
end

5
spree_paypal_express.gemspec

@ -15,10 +15,11 @@ Gem::Specification.new do |s|
s.add_dependency('spree_core', '~>1.2')
s.add_development_dependency 'capybara', '1.1.2'
s.add_development_dependency 'factory_girl', '~> 3.5.0'
s.add_development_dependency 'capybara', '~> 1.1.2'
s.add_development_dependency 'factory_girl', '~> 3.6.0'
s.add_development_dependency 'ffaker'
s.add_development_dependency 'rspec-rails', '~> 2.11.0'
s.add_development_dependency 'sass-rails'
s.add_development_dependency 'simplecov'
s.add_development_dependency 'sqlite3'
end
Loading…
Cancel
Save