mutant-rspec 0.8.8 → 0.8.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mutant/integration/rspec.rb +18 -31
  3. metadata +9 -11
  4. data/TODO +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b725e632de947157ec1f1664580d0920ce5d8bcd
4
- data.tar.gz: d2e500873db6676126194f3fe467592c4407e838
3
+ metadata.gz: b08fee6107177b9701d008b59646666911378b48
4
+ data.tar.gz: 1f08f363e3de560a667dcfa6ae378b8ac7a20278
5
5
  SHA512:
6
- metadata.gz: 89a804609d8e5a45af2c9dbd8da3041220455f7b9b9ac02ce1ce352b0bc1cce96dfb517158e5d91851cf6dfa2e30a6689b39179dccf5be93471429c11910f66a
7
- data.tar.gz: 093a426f153182019596ff2417a9282bc04c9767eb1489591da727dde7a18a85745e886bdd5751cc497d46c1957308871b699ba1b522e015cfee4f135f5f8a0d
6
+ metadata.gz: 63b630e88b213b90046787a01ed8d4e02c012bf4f5ae3f62f1ed9ed1de66b5e8bca0dbc36fbd366a44cbbd395246ce408c6f2bc2af8c79ba5cd06da9fe080b70
7
+ data.tar.gz: 37950c27d632e17bb6ae40339fee7360e152c0c57e39a0b5ff2f849d5ed7e1589e7254af9e52085b483c3d12af2f8e5bf5d05cdbce82f2b0c16da3d1497348d9
@@ -9,7 +9,7 @@ module Mutant
9
9
  # * Keeps its state global in RSpec.world and lots of other places
10
10
  # * There is no API to "just run a subset of examples", the examples
11
11
  # need to be selected in-place via mutating the `RSpec.filtered_examples`
12
- # datastructure
12
+ # data structure
13
13
  # * Does not maintain a unique identification for an example,
14
14
  # aside the instances of `RSpec::Core::Example` objects itself.
15
15
  # For that reason identifying examples by:
@@ -17,6 +17,8 @@ module Mutant
17
17
  # * location
18
18
  # Is NOT enough. It would not be unique. So we add an "example index"
19
19
  # for unique reference.
20
+ #
21
+ # :reek:TooManyConstants
20
22
  class Rspec < self
21
23
 
22
24
  ALL_EXPRESSION = Expression::Namespace::Recursive.new(scope_name: nil)
@@ -24,16 +26,13 @@ module Mutant
24
26
  LOCATION_DELIMITER = ':'.freeze
25
27
  EXIT_SUCCESS = 0
26
28
  CLI_OPTIONS = IceNine.deep_freeze(%w[spec --fail-fast])
29
+ TEST_ID_FORMAT = 'rspec:%<index>d:%<location>s/%<description>s'.freeze
27
30
 
28
31
  private_constant(*constants(false))
29
32
 
30
- register 'rspec'
31
-
32
33
  # Initialize rspec integration
33
34
  #
34
35
  # @return [undefined]
35
- #
36
- # @api private
37
36
  def initialize(*)
38
37
  super
39
38
  @output = StringIO.new
@@ -44,8 +43,6 @@ module Mutant
44
43
  # Setup rspec integration
45
44
  #
46
45
  # @return [self]
47
- #
48
- # @api private
49
46
  def setup
50
47
  @runner.setup($stderr, @output)
51
48
  self
@@ -59,8 +56,6 @@ module Mutant
59
56
  # @return [Result::Test]
60
57
  #
61
58
  # rubocop:disable MethodLength
62
- #
63
- # @api private
64
59
  def call(tests)
65
60
  examples = tests.map(&all_tests_index.method(:fetch))
66
61
  filter_examples(&examples.method(:include?))
@@ -68,18 +63,16 @@ module Mutant
68
63
  passed = @runner.run_specs(@world.ordered_example_groups).equal?(EXIT_SUCCESS)
69
64
  @output.rewind
70
65
  Result::Test.new(
71
- tests: tests,
72
- output: @output.read,
73
- runtime: Time.now - start,
74
- passed: passed
66
+ output: @output.read,
67
+ passed: passed,
68
+ runtime: Time.now - start,
69
+ tests: tests
75
70
  )
76
71
  end
77
72
 
78
73
  # Available tests
79
74
  #
80
75
  # @return [Enumerable<Test>]
81
- #
82
- # @api private
83
76
  def all_tests
84
77
  all_tests_index.keys
85
78
  end
@@ -90,8 +83,6 @@ module Mutant
90
83
  # Index of available tests
91
84
  #
92
85
  # @return [Hash<Test, RSpec::Core::Example]
93
- #
94
- # @api private
95
86
  def all_tests_index
96
87
  all_examples.each_with_index.each_with_object({}) do |(example, example_index), index|
97
88
  index[parse_example(example, example_index)] = example
@@ -105,26 +96,26 @@ module Mutant
105
96
  # @param [Fixnum] index
106
97
  #
107
98
  # @return [Test]
108
- #
109
- # @api private
110
99
  def parse_example(example, index)
111
- metadata = example.metadata
112
- location = metadata.fetch(:location)
113
- full_description = metadata.fetch(:full_description)
100
+ metadata = example.metadata
101
+
102
+ id = TEST_ID_FORMAT % {
103
+ index: index,
104
+ location: metadata.fetch(:location),
105
+ description: metadata.fetch(:full_description)
106
+ }
114
107
 
115
108
  Test.new(
116
- id: "rspec:#{index}:#{location}/#{full_description}",
117
- expression: parse_expression(metadata)
109
+ expression: parse_expression(metadata),
110
+ id: id
118
111
  )
119
112
  end
120
113
 
121
114
  # Parse metadata into expression
122
115
  #
123
- # @param [RSpec::Core::Example::Medatada] metadata
116
+ # @param [RSpec::Core::Example::MetaData] metadata
124
117
  #
125
118
  # @return [Expression]
126
- #
127
- # @api private
128
119
  def parse_expression(metadata)
129
120
  if metadata.key?(:mutant_expression)
130
121
  expression_parser.(metadata.fetch(:mutant_expression))
@@ -137,8 +128,6 @@ module Mutant
137
128
  # Available rspec examples
138
129
  #
139
130
  # @return [Array<String, RSpec::Core::Example]
140
- #
141
- # @api private
142
131
  def all_examples
143
132
  @world.example_groups.flat_map(&:descendants).flat_map(&:examples).select do |example|
144
133
  example.metadata.fetch(:mutant, true)
@@ -150,8 +139,6 @@ module Mutant
150
139
  # @param [#call] predicate
151
140
  #
152
141
  # @return [undefined]
153
- #
154
- # @api private
155
142
  def filter_examples(&predicate)
156
143
  @world.filtered_examples.each_value do |examples|
157
144
  examples.keep_if(&predicate)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutant-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.8.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-15 00:00:00.000000000 Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mutant
@@ -16,34 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.8.8
19
+ version: 0.8.11
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.8.8
26
+ version: 0.8.11
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec-core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 3.2.0
33
+ version: 3.4.0
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: 3.5.0
36
+ version: 3.6.0
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 3.2.0
43
+ version: 3.4.0
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: 3.5.0
46
+ version: 3.6.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -70,11 +70,9 @@ email:
70
70
  executables: []
71
71
  extensions: []
72
72
  extra_rdoc_files:
73
- - TODO
74
73
  - LICENSE
75
74
  files:
76
75
  - LICENSE
77
- - TODO
78
76
  - lib/mutant/integration/rspec.rb
79
77
  homepage: https://github.com/mbj/mutant
80
78
  licenses:
@@ -96,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
94
  version: '0'
97
95
  requirements: []
98
96
  rubyforge_project:
99
- rubygems_version: 2.4.5.1
97
+ rubygems_version: 2.5.1
100
98
  signing_key:
101
99
  specification_version: 4
102
100
  summary: Rspec integration for mutant
data/TODO DELETED
@@ -1,21 +0,0 @@
1
- Code:
2
- * Test mutant with dynamically created zombie.
3
-
4
- Mutations:
5
- * Add true masgn mutations
6
- * Add some kind of a "do not touch me object" that raises on all messages.
7
- It can be used to make sure each literal value is touched.
8
- * Replace nil or add "do not touch me object" to literal mutations.
9
- * Mutate options on Regexp literals
10
- * Add mutations for dynamic regexp symbol and string literals
11
- * Add timeout to terminate infinite loops
12
-
13
- Loader:
14
- * Make sure loader does not change visibility of injected mutants
15
-
16
- Matcher:
17
- * Allow matches on attr_reader with literal name argument(s)?
18
- * Allow matches on define_method with literal name argument?
19
-
20
- jruby-support:
21
- * Create a runtime per mutation to kill mutations in isolation