wtt-rspec 0.1.14
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 +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +3 -0
- data/README.md +36 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/wtt/rspec/formatter.rb +49 -0
- data/lib/wtt/rspec/indexer.rb +48 -0
- data/lib/wtt/rspec/map_task.rb +44 -0
- data/lib/wtt/rspec/spec_task.rb +44 -0
- data/lib/wtt/rspec/version.rb +7 -0
- data/lib/wtt/rspec.rb +4 -0
- data/wtt_rspec.gemspec +26 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9a627ff12db9ae7e3434572f44c7e90260537c69
|
4
|
+
data.tar.gz: 4fa701dd7ee81639a3a23012a7837bdb32a2d9a0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cce7145c78a0760f54dfc558142939c192a919ad7272189b8cded0f026fad986e66ef0161282fb367efac04dad47417df8fdbca02dcef5f7d1b69a626b5e09d0
|
7
|
+
data.tar.gz: 5b179dad3cc72103fc7776259522cf35dd0b5ee0c9de5ac46807d41da084f458517de849e9c9b1272e189d613677ac63b7a085ef94fcea7cff0b4526f1745fd5
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# WttRspec
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/wtt_rspec`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'wtt'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install wtt_rspec
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/wtt_rspec.
|
36
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "wtt"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rspec/core'
|
2
|
+
RSpec::Support.require_rspec_core 'formatters/base_formatter'
|
3
|
+
require 'wtt'
|
4
|
+
require 'rugged'
|
5
|
+
|
6
|
+
|
7
|
+
# Top level namespace for What to Test
|
8
|
+
module WTT
|
9
|
+
# Functionality related to rspec
|
10
|
+
module RSpec
|
11
|
+
# Rspec formatter that gathers coverage information for each scenario.
|
12
|
+
class Formatter < ::RSpec::Core::Formatters::BaseFormatter
|
13
|
+
::RSpec::Core::Formatters.register self, :example_passed, :example_failed, :close, :start
|
14
|
+
|
15
|
+
def initialize(output)
|
16
|
+
super
|
17
|
+
@tests = []
|
18
|
+
@repo = Rugged::Repository.discover(Dir.pwd)
|
19
|
+
@storage = WTT::Core::Storage.new @repo
|
20
|
+
@mapping = WTT::Core::Mapper.new(@storage)
|
21
|
+
@tracer = WTT::Core::Tracer.new
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def start(_notification)
|
26
|
+
@tracer.start_trace
|
27
|
+
end
|
28
|
+
|
29
|
+
def example_passed(notification)
|
30
|
+
record_example notification.example
|
31
|
+
end
|
32
|
+
|
33
|
+
def example_failed(notification)
|
34
|
+
record_example notification.example
|
35
|
+
end
|
36
|
+
|
37
|
+
def record_example(example)
|
38
|
+
@tracer.stop_trace
|
39
|
+
@mapping.append_from_coverage("RSPEC:#{example.id}", @tracer.coverage)
|
40
|
+
@tracer.start_trace
|
41
|
+
end
|
42
|
+
|
43
|
+
def close(_example)
|
44
|
+
@tracer.stop_trace
|
45
|
+
@mapping.write!
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rspec/core'
|
2
|
+
RSpec::Support.require_rspec_core 'formatters/base_formatter'
|
3
|
+
require 'wtt'
|
4
|
+
require 'rugged'
|
5
|
+
require 'wtt/core'
|
6
|
+
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.before(:each) do
|
9
|
+
fail('Fail each test immediately' ) if ENV['WTT_INDEXING'] == '1'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Top level namespace for What to Test
|
14
|
+
module WTT
|
15
|
+
# Functionality related to rspec
|
16
|
+
module RSpec
|
17
|
+
# @private
|
18
|
+
class Indexer < ::RSpec::Core::Formatters::BaseFormatter
|
19
|
+
::RSpec::Core::Formatters.register self, :example_passed, :example_failed, :close
|
20
|
+
def initialize(output)
|
21
|
+
super
|
22
|
+
@tests = []
|
23
|
+
ENV['WTT_INDEXING'] ||= '1'
|
24
|
+
@repo = Rugged::Repository.discover(Dir.pwd)
|
25
|
+
@storage = WTT::Core::Storage.new(@repo)
|
26
|
+
@mapping = WTT::Core::Mapper.new(@storage)
|
27
|
+
end
|
28
|
+
|
29
|
+
def example_passed(notification)
|
30
|
+
record_example notification.example
|
31
|
+
end
|
32
|
+
|
33
|
+
def example_failed(notification)
|
34
|
+
record_example notification.example
|
35
|
+
end
|
36
|
+
|
37
|
+
def record_example(example)
|
38
|
+
@tests << example.id
|
39
|
+
end
|
40
|
+
|
41
|
+
def close(_example)
|
42
|
+
meta = WTT::Core::MetaData.new(@storage)
|
43
|
+
meta['specs'] = @tests
|
44
|
+
meta.write!
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
require 'rspec/support'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
# Top level namespace for What to Test
|
7
|
+
module WTT
|
8
|
+
# Functionality related to rspec
|
9
|
+
module RSpec
|
10
|
+
# Task that runs all specs and produces a map.
|
11
|
+
class MapTask < ::RSpec::Core::RakeTask
|
12
|
+
MAP_FORMATTER = '--require wtt/rspec/formatter --format WTT::RSpec::Formatter --format progress'.freeze
|
13
|
+
|
14
|
+
def format_opts(formatter)
|
15
|
+
"#{formatter} #{rspec_opts} --no-fail-fast"
|
16
|
+
end
|
17
|
+
|
18
|
+
def map_command
|
19
|
+
cmd_parts = []
|
20
|
+
cmd_parts << RUBY
|
21
|
+
cmd_parts << ruby_opts
|
22
|
+
cmd_parts << rspec_load_path
|
23
|
+
cmd_parts << escape(rspec_path)
|
24
|
+
cmd_parts << file_exclusion_specification
|
25
|
+
cmd_parts << file_inclusion_specification
|
26
|
+
cmd_parts << format_opts( MAP_FORMATTER )
|
27
|
+
cmd_parts.flatten.reject(&blank).join(" ")
|
28
|
+
end
|
29
|
+
|
30
|
+
def run_task(verbose)
|
31
|
+
WTT.with_active_env do
|
32
|
+
@repo = Rugged::Repository.discover(Dir.pwd)
|
33
|
+
@storage = WTT::Core::Storage.new @repo
|
34
|
+
|
35
|
+
puts 'Mapping RSpec tests...'
|
36
|
+
|
37
|
+
command = "#{map_command}"
|
38
|
+
puts command if verbose
|
39
|
+
system(command)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'wtt/rspec'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/tasklib'
|
4
|
+
require 'rspec/support'
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
|
7
|
+
|
8
|
+
# Top level namespace for What to Test
|
9
|
+
module WTT
|
10
|
+
# Functionality related to rspec
|
11
|
+
module RSpec
|
12
|
+
# Task that runs all specs and produces a map.
|
13
|
+
class SpecTask < ::RSpec::Core::RakeTask
|
14
|
+
MAP_FORMATTER = '--require wtt/rspec/formatter --format WTT::RSpec::Formatter --format progress'.freeze
|
15
|
+
alias_method :orig_rspec_opts, :rspec_opts
|
16
|
+
alias_method :orig_run_task, :run_task
|
17
|
+
|
18
|
+
def rspec_opts
|
19
|
+
"#{MAP_FORMATTER} #{orig_rspec_opts}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def run_task(verbose)
|
23
|
+
WTT.with_active_env { orig_run_task verbose }
|
24
|
+
end
|
25
|
+
|
26
|
+
def file_inclusion_specification
|
27
|
+
repo = Rugged::Repository.discover(Dir.pwd)
|
28
|
+
storage = WTT::Core::Storage.new( repo )
|
29
|
+
meta = WTT::Core::MetaData.new( storage )
|
30
|
+
|
31
|
+
opts = {
|
32
|
+
meta_data: meta,
|
33
|
+
repo: repo,
|
34
|
+
test_files: FileList[pattern].sort.map { |file| escape( file ) },
|
35
|
+
mapping: WTT::Core::Mapper.new( storage )
|
36
|
+
}
|
37
|
+
|
38
|
+
selector = WTT::Core::Selector.new opts
|
39
|
+
tests = selector.select_tests!
|
40
|
+
tests.to_a.select { |t| t.start_with? 'RSPEC:' }.map { |t| t.gsub(/RSPEC:/, '') }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/wtt/rspec.rb
ADDED
data/wtt_rspec.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'wtt/rspec/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'wtt-rspec'
|
8
|
+
spec.version = WTT::RSpec::VERSION
|
9
|
+
spec.authors = ['Donavan Stanley']
|
10
|
+
spec.email = ['dstanley@covermymeds.com']
|
11
|
+
|
12
|
+
spec.summary = 'RSpec support for What to Test'
|
13
|
+
spec.homepage = 'https://github.com/covermymeds/wtt'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = 'exe'
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
spec.required_ruby_version = '>= 2.0'
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'deploy_my_gem'
|
24
|
+
spec.add_development_dependency 'gem-release'
|
25
|
+
spec.add_dependency 'rspec', '~> 3.3'
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wtt-rspec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.14
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Donavan Stanley
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: deploy_my_gem
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: gem-release
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.3'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.3'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- dstanley@covermymeds.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
92
|
+
- Gemfile
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- bin/console
|
96
|
+
- bin/setup
|
97
|
+
- lib/wtt/rspec.rb
|
98
|
+
- lib/wtt/rspec/formatter.rb
|
99
|
+
- lib/wtt/rspec/indexer.rb
|
100
|
+
- lib/wtt/rspec/map_task.rb
|
101
|
+
- lib/wtt/rspec/spec_task.rb
|
102
|
+
- lib/wtt/rspec/version.rb
|
103
|
+
- wtt_rspec.gemspec
|
104
|
+
homepage: https://github.com/covermymeds/wtt
|
105
|
+
licenses: []
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '2.0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.4.5
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: RSpec support for What to Test
|
127
|
+
test_files: []
|