Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Refactor run mutate #1

Merged
merged 2 commits into from about 2 years ago

2 participants

Dan Kubb Josep M. Bach
Dan Kubb

This change fixes the path to point to the new location of the mutate binary and wraps up the run_simple call in a mutant spec helper method.

Josep M. Bach
Owner

Thanks!

Josep M. Bach txus merged commit ca2e1c1 into from February 22, 2012
Josep M. Bach txus closed this February 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 24 changed files with 51 additions and 45 deletions. Show diff stats Hide diff stats

  1. 2  spec/functional/class_spec.rb
  2. 4  spec/functional/instance_method/array_spec.rb
  3. 8  spec/functional/instance_method/boolean_spec.rb
  4. 4  spec/functional/instance_method/fixnum_spec.rb
  5. 4  spec/functional/instance_method/float_spec.rb
  6. 4  spec/functional/instance_method/hash_spec.rb
  7. 4  spec/functional/instance_method/range_spec.rb
  8. 4  spec/functional/instance_method/regex_spec.rb
  9. 4  spec/functional/instance_method/string_spec.rb
  10. 4  spec/functional/instance_method/symbol_spec.rb
  11. 4  spec/functional/reporter/method_loaded_spec.rb
  12. 2  spec/functional/reporter/running_mutations_spec.rb
  13. 2  spec/functional/runners/rspec_spec.rb
  14. 4  spec/functional/singleton_method/array_spec.rb
  15. 8  spec/functional/singleton_method/boolean_spec.rb
  16. 4  spec/functional/singleton_method/fixnum_spec.rb
  17. 4  spec/functional/singleton_method/float_spec.rb
  18. 4  spec/functional/singleton_method/hash_spec.rb
  19. 4  spec/functional/singleton_method/range_spec.rb
  20. 4  spec/functional/singleton_method/regex_spec.rb
  21. 4  spec/functional/singleton_method/string_spec.rb
  22. 4  spec/functional/singleton_method/symbol_spec.rb
  23. 1  spec/spec_helper.rb
  24. 5  spec/support/example_helpers.rb
2  spec/functional/class_spec.rb
@@ -36,7 +36,7 @@ def alphabet_range; 'a'..'k' end
36 36
         end
37 37
       end
38 38
     """
39  
-    run_simple '../../bin/mutate Thing spec/thing_spec.rb'
  39
+    mutate 'Thing spec/thing_spec.rb'
40 40
   end
41 41
 
42 42
   it 'runs all possible mutations' do
4  spec/functional/instance_method/array_spec.rb
@@ -22,7 +22,7 @@ def to_a
22 22
               specify { Thing.new.to_a.should eq([1,2,3]) }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Thing#to_a spec/thing_spec.rb'
  25
+          mutate 'Thing#to_a spec/thing_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def to_a
39 39
               specify { Thing.new.to_a.should respond_to(:length) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Thing#to_a spec/thing_spec.rb'
  42
+          mutate 'Thing#to_a spec/thing_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
8  spec/functional/instance_method/boolean_spec.rb
@@ -22,7 +22,7 @@ def alive?
22 22
               specify { Thing.new.should be_alive }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Thing#alive? spec/thing_spec.rb'
  25
+          mutate 'Thing#alive? spec/thing_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def alive?
39 39
               specify { String(Thing.new.alive?).should =~ /true|false/ }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Thing#alive? spec/thing_spec.rb'
  42
+          mutate 'Thing#alive? spec/thing_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
@@ -68,7 +68,7 @@ def alive?
68 68
               specify { Thing.new.should_not be_alive }
69 69
             end
70 70
           """
71  
-          run_simple '../../bin/mutate Thing#alive? spec/thing_spec.rb'
  71
+          mutate 'Thing#alive? spec/thing_spec.rb'
72 72
         end
73 73
 
74 74
         specify 'the mutation passes' do
@@ -85,7 +85,7 @@ def alive?
85 85
               specify { String(Thing.new.alive?).should =~ /true|false/ }
86 86
             end
87 87
           """
88  
-          run_simple '../../bin/mutate Thing#alive? spec/thing_spec.rb'
  88
+          mutate 'Thing#alive? spec/thing_spec.rb'
89 89
         end
90 90
 
91 91
         specify 'the mutation fails' do
4  spec/functional/instance_method/fixnum_spec.rb
@@ -22,7 +22,7 @@ def answer
22 22
               specify { Life.new.answer.should eq(42) }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Life#answer spec/life_spec.rb'
  25
+          mutate 'Life#answer spec/life_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def answer
39 39
               specify { Life.new.answer.should be_a(Fixnum) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Life#answer spec/life_spec.rb'
  42
+          mutate 'Life#answer spec/life_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
4  spec/functional/instance_method/float_spec.rb
@@ -22,7 +22,7 @@ def answer
22 22
               specify { Life.new.answer.should eq(42.5) }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Life#answer spec/life_spec.rb'
  25
+          mutate 'Life#answer spec/life_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def answer
39 39
               specify { Life.new.answer.should be_a(Float) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Life#answer spec/life_spec.rb'
  42
+          mutate 'Life#answer spec/life_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
4  spec/functional/instance_method/hash_spec.rb
@@ -22,7 +22,7 @@ def to_hash
22 22
               specify { Thing.new.to_hash[:foo][:bar].should eq(3) }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Thing#to_hash spec/thing_spec.rb'
  25
+          mutate 'Thing#to_hash spec/thing_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def to_hash
39 39
               specify { Thing.new.to_hash[:foo][:bar].should be_kind_of(Fixnum) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Thing#to_hash spec/thing_spec.rb'
  42
+          mutate 'Thing#to_hash spec/thing_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
4  spec/functional/instance_method/range_spec.rb
@@ -22,7 +22,7 @@ def a_range
22 22
               specify { Thing.new.a_range.should eq('a'..'z') }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Thing#a_range spec/thing_spec.rb'
  25
+          mutate 'Thing#a_range spec/thing_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def a_range
39 39
               specify { Thing.new.a_range.should be_a(Range) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Thing#a_range spec/thing_spec.rb'
  42
+          mutate 'Thing#a_range spec/thing_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
4  spec/functional/instance_method/regex_spec.rb
@@ -24,7 +24,7 @@ def regex
24 24
               end
25 25
             end
26 26
           """
27  
-          run_simple '../../bin/mutate Thing#regex spec/thing_spec.rb'
  27
+          mutate 'Thing#regex spec/thing_spec.rb'
28 28
         end
29 29
 
30 30
         specify 'the mutation passes' do
@@ -41,7 +41,7 @@ def regex
41 41
               specify { Thing.new.regex.should be_kind_of(Regexp) }
42 42
             end
43 43
           """
44  
-          run_simple '../../bin/mutate Thing#regex spec/thing_spec.rb'
  44
+          mutate 'Thing#regex spec/thing_spec.rb'
45 45
         end
46 46
 
47 47
         specify 'the mutation fails' do
4  spec/functional/instance_method/string_spec.rb
@@ -22,7 +22,7 @@ def a_string
22 22
               specify { Thing.new.a_string.should eq('foo') }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Thing#a_string spec/thing_spec.rb'
  25
+          mutate 'Thing#a_string spec/thing_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def a_string
39 39
               specify { Thing.new.a_string.should be_a(String) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Thing#a_string spec/thing_spec.rb'
  42
+          mutate 'Thing#a_string spec/thing_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
4  spec/functional/instance_method/symbol_spec.rb
@@ -22,7 +22,7 @@ def a_symbol
22 22
               specify { Thing.new.a_symbol.should eq(:foo) }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Thing#a_symbol spec/thing_spec.rb'
  25
+          mutate 'Thing#a_symbol spec/thing_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def a_symbol
39 39
               specify { Thing.new.a_symbol.should be_a(Symbol) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Thing#a_symbol spec/thing_spec.rb'
  42
+          mutate 'Thing#a_symbol spec/thing_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
4  spec/functional/reporter/method_loaded_spec.rb
@@ -18,7 +18,7 @@ def alive?
18 18
             specify { Thing.new.should be_alive }
19 19
           end
20 20
         """
21  
-        run_simple '../../bin/mutate Thing#alive? spec/thing_spec.rb'
  21
+        mutate 'Thing#alive? spec/thing_spec.rb'
22 22
       end
23 23
 
24 24
       it 'displays the number of possible mutations' do
@@ -45,7 +45,7 @@ def alive?
45 45
             specify { Thing.new.alive?.should be_nil }
46 46
           end
47 47
         """
48  
-        run_simple '../../bin/mutate Thing#alive? spec/thing_spec.rb'
  48
+        mutate 'Thing#alive? spec/thing_spec.rb'
49 49
       end
50 50
 
51 51
       it 'displays a warning that there are no possible mutations' do
2  spec/functional/reporter/running_mutations_spec.rb
@@ -27,7 +27,7 @@ def alive?
27 27
       ENV['RANDOM_RANGE_MIN'] = '1'
28 28
       ENV['RANDOM_RANGE_MAX'] = '3'
29 29
 
30  
-      run_simple '../../bin/mutate Thing#alive? spec/thing_spec.rb'
  30
+      mutate 'Thing#alive? spec/thing_spec.rb'
31 31
     end
32 32
 
33 33
     after do
2  spec/functional/runners/rspec_spec.rb
@@ -13,7 +13,7 @@ def alive?; true end
13 13
             specify { Thing.new.should_not be_alive }
14 14
           end
15 15
         """
16  
-        run_simple '../../bin/mutate Thing#alive? spec/thing_spec.rb', false
  16
+        mutate 'Thing#alive? spec/thing_spec.rb', false
17 17
       end
18 18
 
19 19
       it 'causes the run to abort' do
4  spec/functional/singleton_method/array_spec.rb
@@ -22,7 +22,7 @@ def self.to_a
22 22
               specify { Thing.to_a.should eq([1,2,3]) }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Thing.to_a spec/thing_spec.rb'
  25
+          mutate 'Thing.to_a spec/thing_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def self.to_a
39 39
               specify { Thing.to_a.should respond_to(:length) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Thing.to_a spec/thing_spec.rb'
  42
+          mutate 'Thing.to_a spec/thing_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
8  spec/functional/singleton_method/boolean_spec.rb
@@ -22,7 +22,7 @@ def self.alive?
22 22
               specify { Thing.should be_alive }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Thing.alive? spec/thing_spec.rb'
  25
+          mutate 'Thing.alive? spec/thing_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def self.alive?
39 39
               specify { String(Thing.alive?).should =~ /true|false/ }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Thing.alive? spec/thing_spec.rb'
  42
+          mutate 'Thing.alive? spec/thing_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
@@ -68,7 +68,7 @@ def self.alive?
68 68
               specify { Thing.should_not be_alive }
69 69
             end
70 70
           """
71  
-          run_simple '../../bin/mutate Thing.alive? spec/thing_spec.rb'
  71
+          mutate 'Thing.alive? spec/thing_spec.rb'
72 72
         end
73 73
 
74 74
         specify 'the mutation passes' do
@@ -85,7 +85,7 @@ def self.alive?
85 85
               specify { String(Thing.alive?).should =~ /true|false/ }
86 86
             end
87 87
           """
88  
-          run_simple '../../bin/mutate Thing.alive? spec/thing_spec.rb'
  88
+          mutate 'Thing.alive? spec/thing_spec.rb'
89 89
         end
90 90
 
91 91
         specify 'the mutation fails' do
4  spec/functional/singleton_method/fixnum_spec.rb
@@ -22,7 +22,7 @@ def self.answer
22 22
               specify { Life.answer.should eq(42) }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Life.answer spec/life_spec.rb'
  25
+          mutate 'Life.answer spec/life_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def self.answer
39 39
               specify { Life.answer.should be_a(Fixnum) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Life.answer spec/life_spec.rb'
  42
+          mutate 'Life.answer spec/life_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
4  spec/functional/singleton_method/float_spec.rb
@@ -22,7 +22,7 @@ def self.answer
22 22
               specify { Life.answer.should eq(42.05) }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Life.answer spec/life_spec.rb'
  25
+          mutate 'Life.answer spec/life_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def self.answer
39 39
               specify { Life.answer.should be_a(Float) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Life.answer spec/life_spec.rb'
  42
+          mutate 'Life.answer spec/life_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
4  spec/functional/singleton_method/hash_spec.rb
@@ -22,7 +22,7 @@ def self.to_hash
22 22
               specify { Thing.to_hash[:foo][:bar].should eq(3) }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Thing.to_hash spec/thing_spec.rb'
  25
+          mutate 'Thing.to_hash spec/thing_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def self.to_hash
39 39
               specify { Thing.to_hash[:foo][:bar].should be_kind_of(Fixnum) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Thing.to_hash spec/thing_spec.rb'
  42
+          mutate 'Thing.to_hash spec/thing_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
4  spec/functional/singleton_method/range_spec.rb
@@ -22,7 +22,7 @@ def self.a_range
22 22
               specify { Thing.a_range.should eq('a'..'z') }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Thing.a_range spec/thing_spec.rb'
  25
+          mutate 'Thing.a_range spec/thing_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def self.a_range
39 39
               specify { Thing.a_range.should be_a(Range) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Thing.a_range spec/thing_spec.rb'
  42
+          mutate 'Thing.a_range spec/thing_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
4  spec/functional/singleton_method/regex_spec.rb
@@ -24,7 +24,7 @@ def self.regex
24 24
               end
25 25
             end
26 26
           """
27  
-          run_simple '../../bin/mutate Thing.regex spec/thing_spec.rb'
  27
+          mutate 'Thing.regex spec/thing_spec.rb'
28 28
         end
29 29
 
30 30
         specify 'the mutation passes' do
@@ -41,7 +41,7 @@ def self.regex
41 41
               specify { Thing.regex.should be_kind_of(Regexp) }
42 42
             end
43 43
           """
44  
-          run_simple '../../bin/mutate Thing.regex spec/thing_spec.rb'
  44
+          mutate 'Thing.regex spec/thing_spec.rb'
45 45
         end
46 46
 
47 47
         specify 'the mutation fails' do
4  spec/functional/singleton_method/string_spec.rb
@@ -22,7 +22,7 @@ def self.a_string
22 22
               specify { Thing.a_string.should eq('foo') }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Thing.a_string spec/thing_spec.rb'
  25
+          mutate 'Thing.a_string spec/thing_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def self.a_string
39 39
               specify { Thing.a_string.should be_a(String) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Thing.a_string spec/thing_spec.rb'
  42
+          mutate 'Thing.a_string spec/thing_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
4  spec/functional/singleton_method/symbol_spec.rb
@@ -22,7 +22,7 @@ def self.a_symbol
22 22
               specify { Thing.a_symbol.should eq(:foo) }
23 23
             end
24 24
           """
25  
-          run_simple '../../bin/mutate Thing.a_symbol spec/thing_spec.rb'
  25
+          mutate 'Thing.a_symbol spec/thing_spec.rb'
26 26
         end
27 27
 
28 28
         specify 'the mutation passes' do
@@ -39,7 +39,7 @@ def self.a_symbol
39 39
               specify { Thing.a_symbol.should be_a(Symbol) }
40 40
             end
41 41
           """
42  
-          run_simple '../../bin/mutate Thing.a_symbol spec/thing_spec.rb'
  42
+          mutate 'Thing.a_symbol spec/thing_spec.rb'
43 43
         end
44 44
 
45 45
         specify 'the mutation fails' do
1  spec/spec_helper.rb
@@ -8,6 +8,7 @@
8 8
   config.filter_run :focus
9 9
   config.run_all_when_everything_filtered = true
10 10
   config.extend ExampleGroupHelpers
  11
+  config.include ExampleHelpers
11 12
 
12 13
   {:example_group => {:file_path => /spec\/functional/}}.tap do |options|
13 14
     config.include Aruba::Api, options
5  spec/support/example_helpers.rb
... ...
@@ -0,0 +1,5 @@
  1
+module ExampleHelpers
  2
+  def mutate(cmd, fail_on_error = true)
  3
+    run_simple "../../exe/mutate #{cmd}", fail_on_error
  4
+  end
  5
+end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.