miss_cleo 0.4.4 → 0.4.5
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/lib/miss_cleo.rb +1 -2
- data/lib/miss_cleo/template_tracker.rb +27 -0
- data/lib/miss_cleo/test_configurations/cucumber_config.rb +4 -2
- data/lib/miss_cleo/test_configurations/rails_action_view_config.rb +1 -1
- data/lib/miss_cleo/test_configurations/rspec_config.rb +4 -2
- data/lib/miss_cleo/version.rb +1 -1
- metadata +4 -5
- data/lib/miss_cleo/template_helper.rb +0 -22
- data/lib/miss_cleo/test_configurations/action_view_hook.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 630dc170c4e5fa41d6b7065b750dc9f07616b1bf
|
4
|
+
data.tar.gz: 3add2d4e3b0a222a3e1f0f9c4736829d6e42c39a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44af7a7fecb387a9cd5909beb63583889b3d64450de17f2718279c454875894eae901878a35f762aeeea5a0f4c300b0a32860076353a91abd1402cbb97090ca9
|
7
|
+
data.tar.gz: 986641acb95593f84854d59c17b2873d4a98e15e320a74ebc047ddf80be0983a78b20e4fc20d93950fbcf738a7a6fea1b040d8200bcc2cdf14148a767a74289f
|
data/lib/miss_cleo.rb
CHANGED
@@ -12,9 +12,8 @@ require 'miss_cleo/coverage_map'
|
|
12
12
|
require 'miss_cleo/test_configurations/cucumber_config'
|
13
13
|
require 'miss_cleo/test_configurations/rspec_config'
|
14
14
|
require 'miss_cleo/coverage_map_helper.rb'
|
15
|
-
require 'miss_cleo/test_configurations/action_view_hook'
|
16
15
|
require 'miss_cleo/test_configurations/rails_action_view_config'
|
17
|
-
require 'miss_cleo/
|
16
|
+
require 'miss_cleo/template_tracker'
|
18
17
|
|
19
18
|
module MissCleo
|
20
19
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module MissCleo
|
2
|
+
module TemplateTracker
|
3
|
+
module_function
|
4
|
+
|
5
|
+
def initialize_tracker
|
6
|
+
@templates = []
|
7
|
+
end
|
8
|
+
|
9
|
+
def add_to_template_coverage(template)
|
10
|
+
@templates << (trim_path(template))
|
11
|
+
end
|
12
|
+
|
13
|
+
def clear_templates
|
14
|
+
@templates.clear
|
15
|
+
end
|
16
|
+
|
17
|
+
def templates
|
18
|
+
@templates
|
19
|
+
end
|
20
|
+
|
21
|
+
def trim_path(path)
|
22
|
+
path.gsub(/#{Regexp.quote(`pwd`.chomp)}\//, "")
|
23
|
+
end
|
24
|
+
|
25
|
+
private_class_method :trim_path
|
26
|
+
end
|
27
|
+
end
|
@@ -6,13 +6,15 @@ module MissCleo
|
|
6
6
|
|
7
7
|
def self.setup_hooks(context)
|
8
8
|
if ENV["COVERAGE"]
|
9
|
+
MissCleo::TemplateTracker.initialize_tracker
|
10
|
+
ActionView::Template.prepend MissCleo::TestConfigurations::ActionViewConfig if defined? ActionView::Template
|
9
11
|
Coverage.start
|
10
12
|
context.Around do |scenario, execute|
|
11
|
-
MissCleo::
|
13
|
+
MissCleo::TemplateTracker.clear_templates
|
12
14
|
before = Coverage.peek_result
|
13
15
|
execute.call
|
14
16
|
after = Coverage.peek_result
|
15
|
-
templates = MissCleo::
|
17
|
+
templates = MissCleo::TemplateTracker.templates.uniq
|
16
18
|
if file_and_line = scenario.try(:file_colon_line)
|
17
19
|
LOGS << [ file_and_line, { before: CoverageFilter.filter_and_trim(before), after: CoverageFilter.filter_and_trim(after), templates: templates } ]
|
18
20
|
end
|
@@ -6,17 +6,19 @@ module MissCleo
|
|
6
6
|
|
7
7
|
def self.setup_hooks(context)
|
8
8
|
if ENV["COVERAGE"]
|
9
|
+
MissCleo::TemplateTracker.initialize_tracker
|
10
|
+
ActionView::Template.prepend MissCleo::TestConfigurations::ActionViewConfig if defined? ActionView::Template
|
9
11
|
Coverage.start
|
10
12
|
RSpec.configuration.after(:suite) do
|
11
13
|
File.open(RSPEC_MAP, 'w') { |f| f.write JSON.dump LOGS }
|
12
14
|
end
|
13
15
|
|
14
16
|
RSpec.configuration.around(:example) do |example|
|
15
|
-
MissCleo::
|
17
|
+
MissCleo::TemplateTracker.clear_templates
|
16
18
|
before = Coverage.peek_result
|
17
19
|
example.call
|
18
20
|
after = Coverage.peek_result
|
19
|
-
templates = MissCleo::
|
21
|
+
templates = MissCleo::TemplateTracker.templates.uniq
|
20
22
|
LOGS << [ example.location, {
|
21
23
|
before: CoverageFilter.filter_and_trim(before),
|
22
24
|
after: CoverageFilter.filter_and_trim(after),
|
data/lib/miss_cleo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miss_cleo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dean Hu
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-04-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -106,8 +106,7 @@ files:
|
|
106
106
|
- lib/miss_cleo/coverage_filter.rb
|
107
107
|
- lib/miss_cleo/coverage_map.rb
|
108
108
|
- lib/miss_cleo/coverage_map_helper.rb
|
109
|
-
- lib/miss_cleo/
|
110
|
-
- lib/miss_cleo/test_configurations/action_view_hook.rb
|
109
|
+
- lib/miss_cleo/template_tracker.rb
|
111
110
|
- lib/miss_cleo/test_configurations/cucumber_config.rb
|
112
111
|
- lib/miss_cleo/test_configurations/rails_action_view_config.rb
|
113
112
|
- lib/miss_cleo/test_configurations/rspec_config.rb
|
@@ -133,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
132
|
version: '0'
|
134
133
|
requirements: []
|
135
134
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.4.3
|
137
136
|
signing_key:
|
138
137
|
specification_version: 4
|
139
138
|
summary: Regression Test Selection
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module MissCleo
|
2
|
-
module TemplateHelper
|
3
|
-
module_function
|
4
|
-
|
5
|
-
def template_coverage
|
6
|
-
@_template_coverage ||= []
|
7
|
-
end
|
8
|
-
|
9
|
-
def add_to_template_coverage(template)
|
10
|
-
@_template_coverage << trim_path(template)
|
11
|
-
end
|
12
|
-
|
13
|
-
def reset_coverage
|
14
|
-
@_template_coverage = []
|
15
|
-
end
|
16
|
-
|
17
|
-
def trim_path(path)
|
18
|
-
path.gsub(/#{Regexp.quote(`pwd`.chomp)}\//, "")
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|