miss_cleo 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f8abd7c5e894994ddfa4eeaa8c291ae89d60e5f
4
- data.tar.gz: a0711589f129c6cba35c37fcde928da46fe45903
3
+ metadata.gz: 630dc170c4e5fa41d6b7065b750dc9f07616b1bf
4
+ data.tar.gz: 3add2d4e3b0a222a3e1f0f9c4736829d6e42c39a
5
5
  SHA512:
6
- metadata.gz: cdcbdcdea12b7a02b8664d5056ee828e9c780ea45b0875931be42efb3e7ab2a0f8f0da543334d11550cae769d1953b5c431e0e1621e56427002b20ab85c59aec
7
- data.tar.gz: aff49f76e0ae9e9be21b9e82e2c8467638d1c68035c616f7c9b112119637b068572f9017f789897cd7937f99fc13fcf31fc67b043fa7b5459add34a35d22f2ac
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/template_helper'
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::TemplateHelper.reset_coverage
13
+ MissCleo::TemplateTracker.clear_templates
12
14
  before = Coverage.peek_result
13
15
  execute.call
14
16
  after = Coverage.peek_result
15
- templates = MissCleo::TemplateHelper.template_coverage.uniq
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
@@ -2,7 +2,7 @@ module MissCleo
2
2
  module TestConfigurations
3
3
  module ActionViewConfig
4
4
  def render(*args)
5
- MissCleo::TestConfigurations::ActionViewHook.record_template(identifier)
5
+ MissCleo::TemplateTracker.add_to_template_coverage(identifier)
6
6
  super(*args)
7
7
  end
8
8
  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::TemplateHelper.reset_coverage
17
+ MissCleo::TemplateTracker.clear_templates
16
18
  before = Coverage.peek_result
17
19
  example.call
18
20
  after = Coverage.peek_result
19
- templates = MissCleo::TemplateHelper.template_coverage.uniq
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),
@@ -1,3 +1,3 @@
1
1
  module MissCleo
2
- VERSION = "0.4.4"
2
+ VERSION = "0.4.5"
3
3
  end
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
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-03-25 00:00:00.000000000 Z
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/template_helper.rb
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.5.1
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
@@ -1,11 +0,0 @@
1
- module MissCleo
2
- module TestConfigurations
3
- module ActionViewHook
4
- module_function
5
-
6
- def record_template(template)
7
- MissCleo::TemplateHelper.add_to_template_coverage(template)
8
- end
9
- end
10
- end
11
- end