diff --git a/.gitignore b/.gitignore index 5e90d24..ca6185e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ .DS_Store .rspec_status .yardoc +coverage doc Gemfile.lock diff --git a/Gemfile b/Gemfile index bd6bbdf..0e9c0c5 100644 --- a/Gemfile +++ b/Gemfile @@ -7,5 +7,10 @@ gemspec gem "rake", "~> 13.0" gem "rspec", "~> 3.0" + gem 'rdoc' gem 'yard' + +gem 'mocha' +gem 'simplecov' +gem 'webmock' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c1a13d4..665c17b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,15 +1,43 @@ # frozen_string_literal: true -require "skyfall" +require 'simplecov' + +SimpleCov.start do + enable_coverage :branch + add_filter "/spec/" +end + +require 'skyfall' +require 'webmock/rspec' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" - # Disable RSpec exposing methods globally on `Module` and `main` - config.disable_monkey_patching! - config.expect_with :rspec do |c| - c.syntax = :expect + c.syntax = [:should, :expect] + end + + config.mock_with :mocha +end + +module SimpleCov + module Formatter + class HTMLFormatter + def format(result) + # silence the stdout summary, just save the html files + unless @inline_assets + Dir[File.join(@public_assets_dir, "*")].each do |path| + FileUtils.cp_r(path, asset_output_path, remove_destination: true) + end + end + + File.open(File.join(output_path, "index.html"), "wb") do |file| + file.puts template("layout").result(binding) + end + end + end end end + +WebMock.enable!