bidi2pdf-rails 0.0.1.pre.alpha → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.idea/bidi2pdf-rails.iml +55 -9
- data/.rubocop.yml +14 -0
- data/CHANGELOG.md +33 -0
- data/README.md +117 -27
- data/Rakefile +2 -0
- data/cliff.toml +126 -0
- data/lib/bidi2pdf_rails/browser_console_log_subscriber.rb +24 -0
- data/lib/bidi2pdf_rails/chromedriver_manager_singleton.rb +11 -11
- data/lib/bidi2pdf_rails/config.rb +133 -0
- data/lib/bidi2pdf_rails/configurable.rb +106 -0
- data/lib/bidi2pdf_rails/main_log_subscriber.rb +33 -0
- data/lib/bidi2pdf_rails/network_log_subscriber.rb +20 -0
- data/lib/bidi2pdf_rails/railtie.rb +12 -45
- data/lib/bidi2pdf_rails/services/html_renderer.rb +33 -0
- data/lib/bidi2pdf_rails/services/html_to_pdf_converter.rb +28 -0
- data/lib/bidi2pdf_rails/services/pdf_browser_session.rb +39 -0
- data/lib/bidi2pdf_rails/services/pdf_renderer.rb +82 -0
- data/lib/bidi2pdf_rails/services/url_to_pdf_converter.rb +82 -0
- data/lib/bidi2pdf_rails/version.rb +1 -1
- data/lib/bidi2pdf_rails.rb +41 -58
- data/lib/generators/bidi2pdf_rails/USAGE +12 -4
- data/lib/generators/bidi2pdf_rails/initializer_generator.rb +136 -30
- data/lib/generators/bidi2pdf_rails/templates/bidi2pdf_rails.rb.tt +25 -79
- data/spec/acceptance/user_can_download_report_pdf_spec.rb +133 -0
- data/spec/acceptance/user_can_generate_pdf_from_protected_remote_url_spec.rb +173 -0
- data/spec/dummy/app/controllers/reports_controller.rb +37 -0
- data/spec/dummy/app/controllers/secure_controller.rb +52 -0
- data/spec/dummy/app/views/layouts/simple.html.erb +17 -0
- data/spec/dummy/app/views/secure/show.html.erb +10 -0
- data/spec/dummy/config/environments/production.rb +1 -1
- data/spec/dummy/config/initializers/bidi2pdf_rails.rb +68 -54
- data/spec/dummy/config/initializers/cors.rb +1 -1
- data/spec/dummy/config/routes.rb +10 -0
- data/spec/dummy/log/development.log +16567 -156
- data/spec/dummy/log/test.log +53046 -0
- data/spec/dummy/tmp/pids/server.pid +1 -1
- data/spec/integration/generators/bidi2pdf_rails/initializer_generator_spec.rb +64 -0
- data/spec/rails_helper.rb +8 -1
- data/spec/spec_helper.rb +47 -5
- data/spec/support/default_dirs_helper.rb +32 -0
- data/spec/support/pdf_helper.rb +12 -0
- data/spec/support/render_setting_helpers.rb +28 -0
- data/spec/support/request_server_bootstrap.rb +44 -0
- data/spec/{bidi2pdf_rails → unit/bidi2pdf_rails}/bidi2pdf_rails_spec.rb +1 -1
- data/spec/unit/bidi2pdf_rails/configurable/base_nested_config_spec.rb +133 -0
- data/tasks/changelog.rake +29 -0
- data/tasks/coverage.rake +23 -0
- metadata +95 -25
- data/lib/bidi2pdf_rails/log_subscriber.rb +0 -13
- data/spec/dummy/spec/helpers/reports_helper_spec.rb +0 -15
- data/spec/dummy/spec/requests/reports_spec.rb +0 -10
- data/spec/dummy/spec/views/reports/show.html.erb_spec.rb +0 -5
- data/spec/generator/bidie2pdf_rails_initializer_generator_spec.rb +0 -5
- data/spec/generator/initializer_generator_spec.rb +0 -5
- data/spec/requests/reports_spec.rb +0 -17
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
37830
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails_helper"
|
4
|
+
require "rails/generators"
|
5
|
+
require "ammeter/init"
|
6
|
+
require "generators/bidi2pdf_rails/initializer_generator"
|
7
|
+
|
8
|
+
RSpec.describe Bidi2pdfRails::InitializerGenerator, type: :generator do
|
9
|
+
destination tmp_file("generators")
|
10
|
+
|
11
|
+
before { prepare_destination }
|
12
|
+
|
13
|
+
after { FileUtils.rm_rf(destination_root) }
|
14
|
+
|
15
|
+
describe 'the generated files' do
|
16
|
+
let(:dev_env_file) { file('config/environments/development.rb') }
|
17
|
+
|
18
|
+
before do
|
19
|
+
FileUtils.mkdir_p dev_env_file.dirname
|
20
|
+
|
21
|
+
# write minimal development.rb file
|
22
|
+
File.write(dev_env_file, <<~RUBY)
|
23
|
+
Rails.application.configure do
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
RUBY
|
28
|
+
|
29
|
+
run_generator %w[
|
30
|
+
--general-verbosity medium
|
31
|
+
--proxy-addr=127.0.0.1
|
32
|
+
--proxy-port=8080
|
33
|
+
--quiet
|
34
|
+
]
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'the initializer file' do
|
38
|
+
subject(:initializer) { file('config/initializers/bidi2pdf_rails.rb') }
|
39
|
+
|
40
|
+
it { is_expected.to be_readable }
|
41
|
+
it { is_expected.to have_correct_syntax }
|
42
|
+
|
43
|
+
Bidi2pdfRails::Config::CONFIG_OPTIONS.each_pair do |group_key, top_level_option|
|
44
|
+
name = top_level_option[:name]
|
45
|
+
it { is_expected.to contain(name) }
|
46
|
+
|
47
|
+
top_level_option[:options].each do |option|
|
48
|
+
option_accessor = "#{group_key}.#{option[:name]}".to_sym
|
49
|
+
if ["proxy_settings.port", "proxy_settings.addr", "general_options.verbosity"].include?(option_accessor.to_s)
|
50
|
+
it { is_expected.to contain("config.#{option_accessor} = ") }
|
51
|
+
else
|
52
|
+
it { is_expected.to contain("# config.#{option_accessor} = #{option[:default_as_str] ? option[:default_as_str] : option[:default].inspect}") }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'the development environment file' do
|
59
|
+
subject(:dev_env_file) { file('config/environments/development.rb') }
|
60
|
+
|
61
|
+
it { is_expected.to contain("config.x.bidi2pdf_rails.headless = false") }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/spec/rails_helper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
require '
|
2
|
+
require 'spec_helper'
|
3
3
|
|
4
4
|
ENV['RAILS_ENV'] ||= 'test'
|
5
5
|
require_relative './dummy/config/environment'
|
@@ -57,4 +57,11 @@ RSpec.configure do |config|
|
|
57
57
|
config.filter_rails_from_backtrace!
|
58
58
|
# arbitrary gems may also be filtered via:
|
59
59
|
# config.filter_gems_from_backtrace("gem name")
|
60
|
+
|
61
|
+
config.alias_example_group_to :feature, feature: true
|
62
|
+
config.alias_example_group_to :when_, feature: true
|
63
|
+
config.alias_example_group_to :given, feature: true
|
64
|
+
config.alias_example_group_to :scenario, feature: true
|
65
|
+
config.alias_example_to :then_, feature: true
|
66
|
+
config.alias_example_to :and_, feature: true
|
60
67
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
require "simplecov"
|
2
|
+
|
3
|
+
if ENV["COVERAGE"]
|
4
|
+
SimpleCov.start do
|
5
|
+
command_name "Job #{ENV["GITHUB_JOB"]}" if ENV["GITHUB_JOB"]
|
6
|
+
|
7
|
+
if ENV["CI"]
|
8
|
+
formatter SimpleCov::Formatter::SimpleFormatter
|
9
|
+
else
|
10
|
+
formatter SimpleCov::Formatter::MultiFormatter.new([
|
11
|
+
SimpleCov::Formatter::SimpleFormatter,
|
12
|
+
SimpleCov::Formatter::HTMLFormatter
|
13
|
+
])
|
14
|
+
end
|
15
|
+
|
16
|
+
add_filter "/spec/"
|
17
|
+
add_filter "/vendor/"
|
18
|
+
add_filter "/lib/bidi2pdf_rails/version.rb"
|
19
|
+
# Add any other paths you want to exclude
|
20
|
+
|
21
|
+
add_group "Lib", "lib"
|
22
|
+
|
23
|
+
track_files "lib/**/*.rb"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
1
27
|
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
2
28
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
29
|
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
@@ -44,9 +70,6 @@ RSpec.configure do |config|
|
|
44
70
|
# triggering implicit auto-inclusion in groups with matching metadata.
|
45
71
|
config.shared_context_metadata_behavior = :apply_to_host_groups
|
46
72
|
|
47
|
-
# The settings below are suggested to provide a good initial experience
|
48
|
-
# with RSpec, but feel free to customize to your heart's content.
|
49
|
-
=begin
|
50
73
|
# This allows you to limit a spec run to individual examples or groups
|
51
74
|
# you care about by tagging them with `:focus` metadata. When nothing
|
52
75
|
# is tagged with `:focus`, all examples get run. RSpec also provides
|
@@ -57,7 +80,7 @@ RSpec.configure do |config|
|
|
57
80
|
# Allows RSpec to persist some state between runs in order to support
|
58
81
|
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
59
82
|
# you configure your source control system to ignore this file.
|
60
|
-
config.example_status_persistence_file_path = "
|
83
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
61
84
|
|
62
85
|
# Limits the available syntax to the non-monkey patched syntax that is
|
63
86
|
# recommended. For more details, see:
|
@@ -90,5 +113,24 @@ RSpec.configure do |config|
|
|
90
113
|
# test failures related to randomization by passing the same `--seed` value
|
91
114
|
# as the one that triggered the failure.
|
92
115
|
Kernel.srand config.seed
|
93
|
-
|
116
|
+
|
117
|
+
config.define_derived_metadata(file_path: %r{/spec/unit/}) do |metadata|
|
118
|
+
metadata[:unit] = true
|
119
|
+
end
|
120
|
+
|
121
|
+
config.define_derived_metadata(file_path: %r{/spec/integration/}) do |metadata|
|
122
|
+
metadata[:integration] = true
|
123
|
+
end
|
124
|
+
|
125
|
+
config.define_derived_metadata(file_path: %r{/spec/acceptance/}) do |metadata|
|
126
|
+
metadata[:acceptance] = true
|
127
|
+
end
|
128
|
+
|
129
|
+
config.add_setting :spec_dir, default: File.expand_path(__dir__)
|
94
130
|
end
|
131
|
+
|
132
|
+
require_relative "support/default_dirs_helper" # just to ensure that the folder definitions are loaded first
|
133
|
+
|
134
|
+
Dir[File.expand_path("support/**/*.rb", __dir__)].each { |f| require f }
|
135
|
+
|
136
|
+
require "bidi2pdf/test_helpers"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "securerandom"
|
4
|
+
module DefaultDirsHelper
|
5
|
+
def spec_dir
|
6
|
+
RSpec.configuration.spec_dir
|
7
|
+
end
|
8
|
+
|
9
|
+
def tmp_dir
|
10
|
+
RSpec.configuration.tmp_dir
|
11
|
+
end
|
12
|
+
|
13
|
+
def tmp_file(*)
|
14
|
+
File.join(tmp_dir, *)
|
15
|
+
end
|
16
|
+
|
17
|
+
def random_tmp_dir(*dirs, prefix: "tmp_")
|
18
|
+
all_dirs = [tmp_dir] + (dirs || []).compact
|
19
|
+
|
20
|
+
File.join(*all_dirs, "#{prefix}#{SecureRandom.hex(8)}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
RSpec.configure do |config|
|
25
|
+
config.add_setting :spec_dir, default: File.expand_path("..", __dir__)
|
26
|
+
|
27
|
+
config.add_setting :tmp_dir, default: File.join(config.spec_dir, "..", "tmp")
|
28
|
+
config.add_setting :docker_dir, default: File.join(config.spec_dir, "..", "docker")
|
29
|
+
|
30
|
+
config.include DefaultDirsHelper
|
31
|
+
config.extend DefaultDirsHelper
|
32
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
module RenderSettingHelpers
|
5
|
+
def with_render_setting(key, value)
|
6
|
+
overridden_render_settings[key] = Bidi2pdfRails.config.render_remote_settings.public_send(key)
|
7
|
+
Bidi2pdfRails.config.render_remote_settings.public_send("#{key}=", value)
|
8
|
+
end
|
9
|
+
|
10
|
+
def overridden_render_settings
|
11
|
+
@__overridden_render_settings ||= {}
|
12
|
+
end
|
13
|
+
|
14
|
+
def reset_render_settings
|
15
|
+
overridden_render_settings.each do |key, original_value|
|
16
|
+
Bidi2pdfRails.config.render_remote_settings.public_send("#{key}=", original_value)
|
17
|
+
end
|
18
|
+
@__overridden_render_settings = {}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
RSpec.configure do |config|
|
23
|
+
config.include RenderSettingHelpers, type: :request
|
24
|
+
|
25
|
+
config.after(:each, type: :request) do
|
26
|
+
reset_render_settings if defined?(reset_render_settings)
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# spec/support/request_server_bootstrap.rb
|
2
|
+
|
3
|
+
module RequestServerBootstrap
|
4
|
+
def find_available_port
|
5
|
+
server = TCPServer.new('127.0.0.1', 0)
|
6
|
+
port = server.addr[1]
|
7
|
+
server.close
|
8
|
+
port
|
9
|
+
end
|
10
|
+
|
11
|
+
def wait_until_server_is_ready(port)
|
12
|
+
loop do
|
13
|
+
begin
|
14
|
+
Net::HTTP.get(URI("http://localhost:#{port}"))
|
15
|
+
break
|
16
|
+
rescue Errno::ECONNREFUSED
|
17
|
+
sleep 0.1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def capybara_manages_server?
|
23
|
+
defined?(Capybara) && Capybara.current_driver && Capybara.server
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
RSpec.configure do |config|
|
28
|
+
config.include RequestServerBootstrap, type: :request
|
29
|
+
|
30
|
+
config.before(:all, type: :request) do
|
31
|
+
next if capybara_manages_server?
|
32
|
+
@port = find_available_port
|
33
|
+
@server_thread = Thread.new do
|
34
|
+
Rack::Handler::Puma.run Rails.application, Port: @port, Silent: true
|
35
|
+
end
|
36
|
+
|
37
|
+
wait_until_server_is_ready(@port)
|
38
|
+
end
|
39
|
+
|
40
|
+
config.after(:all, type: :request) do
|
41
|
+
next if capybara_manages_server?
|
42
|
+
@server_thread&.exit
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_helper'
|
4
|
+
|
5
|
+
RSpec.describe Bidi2pdfRails::Configurable::BaseNestedConfig do
|
6
|
+
subject(:config) { described_class.new(option_definitions) }
|
7
|
+
|
8
|
+
let(:option_definitions) { self.class.option_definitions }
|
9
|
+
|
10
|
+
def self.option_definitions
|
11
|
+
[
|
12
|
+
{ name: :simple_string, default: "default_string", desc: "A simple string option" },
|
13
|
+
{ name: :numeric_value, default: 42, desc: "A numeric value" },
|
14
|
+
{ name: :boolean_flag, default: true, desc: "A boolean flag" },
|
15
|
+
{ name: :lambda_value, default: -> { Date.today }, desc: "A dynamic value from lambda" },
|
16
|
+
{ name: :hash_value, default: { key: "value" }, desc: "A hash value" }
|
17
|
+
]
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#initialize" do
|
21
|
+
option_definitions.each do |opt|
|
22
|
+
it "creates reader methods for #{opt[:name]}" do
|
23
|
+
expect(config).to respond_to(opt[:name])
|
24
|
+
end
|
25
|
+
|
26
|
+
it "creates writer methods for #{opt[:name]}" do
|
27
|
+
expect(config).to respond_to("#{opt[:name]}=")
|
28
|
+
end
|
29
|
+
|
30
|
+
if !opt[:default].is_a?(Proc)
|
31
|
+
it "sets default values for #{opt[:name]}" do
|
32
|
+
expect(config.send(opt[:name])).to eq(opt[:default])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "evaluates lambda defaults when accessed through _value methods" do
|
38
|
+
expect(config.lambda_value_value).to eq(Date.today)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "#reset_to_defaults!" do
|
43
|
+
before do
|
44
|
+
config.simple_string = "changed_value"
|
45
|
+
config.numeric_value = 100
|
46
|
+
config.boolean_flag = false
|
47
|
+
end
|
48
|
+
|
49
|
+
option_definitions.reject { |opt| opt[:name] == :lambda_value }.each do |opt|
|
50
|
+
it "resets #{opt[:name]} to their default" do
|
51
|
+
config.reset_to_defaults!
|
52
|
+
|
53
|
+
expect(config.send(opt[:name])).to eq(opt[:default])
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#configure" do
|
59
|
+
it "yields self to the provided block" do
|
60
|
+
yielded_object = nil
|
61
|
+
|
62
|
+
config.configure do |c|
|
63
|
+
yielded_object = c
|
64
|
+
c.simple_string = "configured_value"
|
65
|
+
end
|
66
|
+
|
67
|
+
expect(yielded_object).to eq(config)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "applies the given values" do
|
71
|
+
config.configure do |c|
|
72
|
+
c.simple_string = "configured_value"
|
73
|
+
end
|
74
|
+
|
75
|
+
expect(config.simple_string).to eq("configured_value")
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "#to_h" do
|
80
|
+
it "returns a hash containing all option values" do
|
81
|
+
result = config.to_h
|
82
|
+
|
83
|
+
expect(result).to include(
|
84
|
+
simple_string: "default_string",
|
85
|
+
numeric_value: 42,
|
86
|
+
boolean_flag: true,
|
87
|
+
lambda_value: Proc,
|
88
|
+
boolean_flag: true,
|
89
|
+
hash_value: { key: "value" }
|
90
|
+
)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe "#_value methods" do
|
95
|
+
context "with regular values" do
|
96
|
+
option_definitions.reject { |opt| opt[:name] == :lambda_value }.each do |opt|
|
97
|
+
it "returns the value directly for #{opt[:name]}" do
|
98
|
+
expect(config.send "#{opt[:name]}_value").to eq(config.send(opt[:name]))
|
99
|
+
end
|
100
|
+
|
101
|
+
it "returns updated values for #{opt[:name]}" do
|
102
|
+
config.send "#{opt[:name]}=", "new_string"
|
103
|
+
|
104
|
+
expect(config.send(opt[:name])).to eq("new_string")
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
context "with lambda values" do
|
110
|
+
it "calls the lambda and returns its result" do
|
111
|
+
today = Date.today
|
112
|
+
expect(config.lambda_value_value).to eq(today)
|
113
|
+
end
|
114
|
+
|
115
|
+
it "returns updated values" do
|
116
|
+
config.lambda_value = -> { "computed_value" }
|
117
|
+
|
118
|
+
expect(config.lambda_value_value).to eq("computed_value")
|
119
|
+
end
|
120
|
+
|
121
|
+
it "accepts arguments for the _value methods" do
|
122
|
+
args = nil
|
123
|
+
config.lambda_value = ->(*lambda_args) { args = lambda_args }
|
124
|
+
|
125
|
+
provided_args = [1, "a", :thing]
|
126
|
+
|
127
|
+
config.lambda_value_value(*provided_args)
|
128
|
+
|
129
|
+
expect(args).to eq(provided_args)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
def cliff_installed?
|
4
|
+
system("which git-cliff > /dev/null 2>&1")
|
5
|
+
end
|
6
|
+
|
7
|
+
namespace :changelog do
|
8
|
+
desc "Generate unreleased section in CHANGELOG.md (requires git-cliff)"
|
9
|
+
task :update_unreleased do
|
10
|
+
unless cliff_installed?
|
11
|
+
puts "🚫 git-cliff is not installed!"
|
12
|
+
puts "👉 Install it here: https://git-cliff.org/docs/installation/"
|
13
|
+
exit 1
|
14
|
+
end
|
15
|
+
|
16
|
+
generated = `git cliff --unreleased`
|
17
|
+
|
18
|
+
changelog_path = "CHANGELOG.md"
|
19
|
+
changelog = File.read(changelog_path)
|
20
|
+
|
21
|
+
updated = changelog.sub(
|
22
|
+
/<!--.*generated\s+by\s+git-cliff\s+start\s+-->(.*?)<!--\s+generated\s+by\s+git-cliff\s+end\s+-->/m,
|
23
|
+
generated.strip
|
24
|
+
)
|
25
|
+
|
26
|
+
File.write(changelog_path, updated)
|
27
|
+
puts "✅ Replaced generated section in CHANGELOG.md"
|
28
|
+
end
|
29
|
+
end
|
data/tasks/coverage.rake
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :coverage do
|
4
|
+
desc "Merge simplecov coverage reports"
|
5
|
+
task :merge_reports do
|
6
|
+
require "simplecov"
|
7
|
+
|
8
|
+
SimpleCov.collate Dir["coverage/*-resultset.json"] do
|
9
|
+
formatter SimpleCov::Formatter::MultiFormatter.new([
|
10
|
+
SimpleCov::Formatter::SimpleFormatter,
|
11
|
+
SimpleCov::Formatter::HTMLFormatter,
|
12
|
+
SimpleCov::Formatter::JSONFormatter
|
13
|
+
])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run tests with coverage"
|
18
|
+
task :coverage do
|
19
|
+
ENV["COVERAGE"] = "true"
|
20
|
+
Rake::Task["spec"].execute
|
21
|
+
puts "Coverage report generated in coverage/ directory"
|
22
|
+
end
|
23
|
+
end
|