infinity_test 1.0.3 → 2.0.0.rc1

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.
Files changed (148) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ci.yml +31 -0
  3. data/.gitignore +3 -0
  4. data/.rspec +2 -2
  5. data/AI_INTEGRATION_IDEAS.md +203 -0
  6. data/Gemfile +3 -15
  7. data/History.markdown +82 -0
  8. data/{.infinity_test → INFINITY_TEST} +18 -15
  9. data/LICENSE.txt +2 -2
  10. data/README.md +627 -0
  11. data/Rakefile +1 -65
  12. data/TODO.markdown +24 -19
  13. data/bin/infinity_test +1 -4
  14. data/images/fuuu/pending.png +0 -0
  15. data/images/fuuu/success.png +0 -0
  16. data/infinity_test.gemspec +41 -189
  17. data/lib/infinity_test/core/auto_discover.rb +67 -0
  18. data/lib/infinity_test/core/base.rb +369 -0
  19. data/lib/infinity_test/core/callback.rb +59 -0
  20. data/lib/infinity_test/core/changed_file.rb +13 -0
  21. data/lib/infinity_test/core/command_builder.rb +48 -0
  22. data/lib/infinity_test/core/command_runner.rb +62 -0
  23. data/lib/infinity_test/core/configuration_merge.rb +37 -0
  24. data/lib/infinity_test/core/continuous_test_server.rb +106 -0
  25. data/lib/infinity_test/core/load_configuration.rb +48 -0
  26. data/lib/infinity_test/core/notifier.rb +59 -0
  27. data/lib/infinity_test/core/options.rb +134 -0
  28. data/lib/infinity_test/core/runner.rb +18 -0
  29. data/lib/infinity_test/core/version.rb +5 -0
  30. data/lib/infinity_test/framework/base.rb +57 -0
  31. data/lib/infinity_test/framework/padrino.rb +33 -0
  32. data/lib/infinity_test/framework/rails.rb +35 -0
  33. data/lib/infinity_test/framework/rubygems.rb +29 -0
  34. data/lib/infinity_test/framework/shared_example.rb +47 -0
  35. data/lib/infinity_test/observer/base.rb +40 -0
  36. data/lib/infinity_test/observer/filewatcher.rb +72 -0
  37. data/lib/infinity_test/observer/listen.rb +74 -0
  38. data/lib/infinity_test/observer/shared_example.rb +35 -0
  39. data/lib/infinity_test/old_dsl/configuration.rb +26 -0
  40. data/lib/infinity_test/strategy/base.rb +34 -0
  41. data/lib/infinity_test/strategy/rbenv.rb +32 -0
  42. data/lib/infinity_test/strategy/ruby_default.rb +20 -0
  43. data/lib/infinity_test/strategy/rvm.rb +50 -0
  44. data/lib/infinity_test/strategy/shared_example.rb +32 -0
  45. data/lib/infinity_test/test_framework/base.rb +64 -0
  46. data/lib/infinity_test/test_framework/rspec.rb +48 -0
  47. data/lib/infinity_test/test_framework/shared_example.rb +56 -0
  48. data/lib/infinity_test/test_framework/test_unit.rb +57 -0
  49. data/lib/infinity_test.rb +53 -35
  50. data/spec/infinity_test/core/auto_discover_spec.rb +149 -0
  51. data/spec/infinity_test/core/base_spec.rb +240 -0
  52. data/spec/infinity_test/core/callback_spec.rb +89 -0
  53. data/spec/infinity_test/core/changed_file_spec.rb +26 -0
  54. data/spec/infinity_test/core/command_builder_spec.rb +38 -0
  55. data/spec/infinity_test/core/configuration_merge_spec.rb +124 -0
  56. data/spec/infinity_test/core/continuous_test_server_spec.rb +116 -0
  57. data/spec/infinity_test/core/load_configuration_spec.rb +43 -0
  58. data/spec/infinity_test/core/notifier_spec.rb +151 -0
  59. data/spec/infinity_test/core/options_spec.rb +168 -0
  60. data/spec/infinity_test/core/runner_spec.rb +17 -0
  61. data/spec/infinity_test/framework/base_spec.rb +55 -0
  62. data/spec/infinity_test/framework/padrino_spec.rb +36 -0
  63. data/spec/infinity_test/framework/rails_spec.rb +36 -0
  64. data/spec/infinity_test/framework/rubygems_spec.rb +34 -0
  65. data/spec/infinity_test/observer/base_spec.rb +78 -0
  66. data/spec/infinity_test/observer/filewatcher_spec.rb +51 -0
  67. data/spec/infinity_test/observer/listen_spec.rb +50 -0
  68. data/spec/infinity_test/{builder_spec.rb → strategy/base_spec.rb} +1 -2
  69. data/spec/infinity_test/strategy/rbenv_spec.rb +53 -0
  70. data/spec/infinity_test/strategy/ruby_default_spec.rb +32 -0
  71. data/spec/infinity_test/strategy/rvm_spec.rb +69 -0
  72. data/spec/infinity_test/test_framework/rspec_spec.rb +119 -0
  73. data/spec/infinity_test/test_framework/test_unit_spec.rb +193 -0
  74. data/spec/spec_helper.rb +34 -119
  75. metadata +272 -176
  76. data/.rvmrc +0 -1
  77. data/Gemfile.lock +0 -62
  78. data/Readme.markdown +0 -147
  79. data/Tasks +0 -4
  80. data/VERSION.yml +0 -5
  81. data/buzz_images/buzz_lightyear.jpg +0 -0
  82. data/buzz_images/buzz_lightyear_continencia.gif +0 -0
  83. data/buzz_images/to_infinity_and_beyond.png +0 -0
  84. data/features/heuristics.feature +0 -23
  85. data/features/support/env.rb +0 -2
  86. data/images/fuuu/sucess.png +0 -0
  87. data/lib/infinity_test/application.rb +0 -362
  88. data/lib/infinity_test/application_library/rails.rb +0 -94
  89. data/lib/infinity_test/application_library/rubygems.rb +0 -43
  90. data/lib/infinity_test/binary_path.rb +0 -43
  91. data/lib/infinity_test/builder.rb +0 -66
  92. data/lib/infinity_test/command.rb +0 -58
  93. data/lib/infinity_test/configuration.rb +0 -277
  94. data/lib/infinity_test/continuous_testing.rb +0 -40
  95. data/lib/infinity_test/dependencies.rb +0 -80
  96. data/lib/infinity_test/environment.rb +0 -15
  97. data/lib/infinity_test/heuristics.rb +0 -36
  98. data/lib/infinity_test/heuristics_helper.rb +0 -9
  99. data/lib/infinity_test/options.rb +0 -96
  100. data/lib/infinity_test/runner.rb +0 -38
  101. data/lib/infinity_test/test_framework.rb +0 -110
  102. data/lib/infinity_test/test_library/bacon.rb +0 -55
  103. data/lib/infinity_test/test_library/cucumber.rb +0 -22
  104. data/lib/infinity_test/test_library/rspec.rb +0 -60
  105. data/lib/infinity_test/test_library/test_unit.rb +0 -52
  106. data/lib/infinity_test/test_unit_loader.rb +0 -5
  107. data/spec/factories/buzz/lib/buzz.rb +0 -0
  108. data/spec/factories/buzz/spec/buzz_spec.rb +0 -0
  109. data/spec/factories/company/Gemfile +0 -0
  110. data/spec/factories/company/lib/company.rb +0 -0
  111. data/spec/factories/company/test/company_test.rb +0 -0
  112. data/spec/factories/images/failure.png +0 -0
  113. data/spec/factories/images/pending.png +0 -0
  114. data/spec/factories/images/sucess.png +0 -0
  115. data/spec/factories/infinity_test +0 -5
  116. data/spec/factories/infinity_test_example +0 -7
  117. data/spec/factories/slinky/spec/slinky/slinky_spec.rb +0 -0
  118. data/spec/factories/travel/lib/travel.rb +0 -0
  119. data/spec/factories/travel/test/partner_test.rb +0 -0
  120. data/spec/factories/travel/test/travel_test.rb +0 -0
  121. data/spec/factories/wood/lib/wood.rb +0 -0
  122. data/spec/factories/wood/spec/wood_spec.rb +0 -0
  123. data/spec/infinity_test/application_library/rails_spec.rb +0 -140
  124. data/spec/infinity_test/application_library/rubygems_spec.rb +0 -52
  125. data/spec/infinity_test/application_spec.rb +0 -434
  126. data/spec/infinity_test/binary_path_spec.rb +0 -72
  127. data/spec/infinity_test/command_spec.rb +0 -53
  128. data/spec/infinity_test/configuration_spec.rb +0 -382
  129. data/spec/infinity_test/continuous_testing_spec.rb +0 -25
  130. data/spec/infinity_test/environment_spec.rb +0 -23
  131. data/spec/infinity_test/heuristics_helper_spec.rb +0 -15
  132. data/spec/infinity_test/heuristics_spec.rb +0 -127
  133. data/spec/infinity_test/options_spec.rb +0 -111
  134. data/spec/infinity_test/runner_spec.rb +0 -42
  135. data/spec/infinity_test/test_framework_spec.rb +0 -127
  136. data/spec/infinity_test/test_library/bacon_spec.rb +0 -150
  137. data/spec/infinity_test/test_library/cucumber_spec.rb +0 -8
  138. data/spec/infinity_test/test_library/rspec_spec.rb +0 -189
  139. data/spec/infinity_test/test_library/test_unit_spec.rb +0 -184
  140. data/spec/infinity_test_spec.rb +0 -40
  141. /data/images/faces/{sucess.png → success.png} +0 -0
  142. /data/images/hands/{sucess.png → success.png} +0 -0
  143. /data/images/mario_bros/{sucess.jpg → success.jpg} +0 -0
  144. /data/images/rails/{sucess.png → success.png} +0 -0
  145. /data/images/rubies/{sucess.png → success.png} +0 -0
  146. /data/images/simpson/{sucess.jpg → success.jpg} +0 -0
  147. /data/images/street_fighter/{sucess.jpg → success.jpg} +0 -0
  148. /data/images/toy_story/{sucess.png → success.png} +0 -0
@@ -1,42 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe InfinityTest::Runner do
4
-
5
- let(:runner_class) { InfinityTest::Runner }
6
-
7
- describe '#initialize' do
8
-
9
- it "should set the application object" do
10
- runner_class.new(['--test-unit']).application.should be_instance_of(InfinityTest::Application)
11
- end
12
-
13
- it "should set the Option Object" do
14
- runner_class.new(['--rspec']).options.should be_instance_of(InfinityTest::Options)
15
- end
16
-
17
- end
18
-
19
- describe '#run!' do
20
- let(:heuristics_runner) { runner_class.new(['--heuristics']) }
21
-
22
- it "should call list heuristics" do
23
- heuristics_runner.should_receive(:list_heuristics!)
24
- heuristics_runner.run!
25
- end
26
-
27
- end
28
-
29
- describe "#start_continuous_testing!" do
30
- let(:empty_runner) { InfinityTest::Runner.new([]) }
31
- let(:mock_continuous_testing) { @mock ||= mock(InfinityTest::ContinuousTesting) }
32
-
33
- it "should call start for Continuous Testing" do
34
- application = application_with_rspec
35
- InfinityTest::ContinuousTesting.should_receive(:new).and_return(mock_continuous_testing)
36
- mock_continuous_testing.should_receive(:start!)
37
- empty_runner.start_continuous_testing!
38
- end
39
-
40
- end
41
-
42
- end
@@ -1,127 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module InfinityTest
4
-
5
- class SomeFramework < TestFramework
6
- parse_results :examples => /(\d+) example/, :failures => /(\d+) failure/, :pending => /(\d+) pending/
7
- end
8
-
9
- class OtherFramework < TestFramework
10
- parse_results :tests => /(\d+) tests/, :assertions => /(\d+) assertions/, :failures => /(\d+) failures/, :errors => /(\d+) errors/
11
- end
12
-
13
- describe "Test Framework" do
14
-
15
- let(:some_framework) { SomeFramework.new }
16
- let(:other_framework) { OtherFramework.new }
17
-
18
- describe '#application' do
19
- it { some_framework.application.should equal InfinityTest.application}
20
- it { other_framework.application.should equal InfinityTest.application}
21
- end
22
-
23
- describe '#parse_results' do
24
-
25
- it "should create the examples instance variable" do
26
- some_framework.parse_results("0 examples, 0 failures, 0 pending")
27
- some_framework.examples.should == 0
28
- end
29
-
30
- it "should create the tests instance variable" do
31
- other_framework.parse_results("120 tests, 200 assertions, 0 failures, 0 errors")
32
- other_framework.tests.should == 120
33
- end
34
-
35
- it "should create the assertions instance variable" do
36
- other_framework.parse_results("120 tests, 200 assertions, 0 failures, 0 errors")
37
- other_framework.assertions.should == 200
38
- end
39
-
40
- it "should create the failures instance variable" do
41
- some_framework.parse_results("0 examples, 1 failures, 0 pending")
42
- some_framework.failures.should == 1
43
- end
44
-
45
- it "should create the failures instance variable" do
46
- other_framework.parse_results("120 tests, 200 assertions, 10 failures, 0 errors")
47
- other_framework.failures.should == 10
48
- end
49
-
50
- it "should create the pending instance variable" do
51
- some_framework.parse_results("0 examples, 0 failures, 1 pending")
52
- some_framework.pending.should == 1
53
- end
54
-
55
- it "should create the example instance variable" do
56
- some_framework.parse_results(" ..... \n10 examples, 0 failures, 0 pending")
57
- some_framework.examples.should == 10
58
- end
59
-
60
- it "should create a message based in the keys of framework" do
61
- some_framework.parse_results(".....\n200 examples, 0 failures, 1 pending")
62
- some_framework.message.should == "200 examples, 0 failures, 1 pending"
63
- end
64
-
65
- it "should create a error message to runtime errors and similars" do
66
- some_framework.parse_results("RunTimeError: undefined method 'my_method' ...")
67
- some_framework.message.should == "An exception occurred"
68
- end
69
-
70
- it "should parse the results correctly(when not have in last line)" do
71
- other_framework.parse_results("....\n10 tests, 35 assertions, 0 failures, 0 errors\nTest run options: --seed 18841")
72
- other_framework.tests.should == 10
73
- other_framework.assertions.should == 35
74
- end
75
-
76
- it "should clear the term ansi colors strings" do
77
- other_framework.parse_results("seconds\n\e[33m406 tests, 34 assertions, 0 failures, 2 errors\e[0m\n")
78
- other_framework.message.should == "406 tests, 34 assertions, 0 failures, 2 errors"
79
- end
80
-
81
- it "should clear the term ansi colors strings" do
82
- some_framework.parse_results("seconds\n\e[33m406 examples, 0 failures, 2 pending\e[0m\n")
83
- some_framework.message.should == "406 examples, 0 failures, 2 pending"
84
- end
85
-
86
- it "should accept other formats (like Fuubar)" do
87
- some_framework.parse_results("299 examples: 99% |ooooooooooooooooooooooooooooooooooooooooo | ETA: 00:00:00\r\e[0m\e[31m\e[0m\e[31m297/298: 100% |oooooooooooooooooooooooooooooooooooooooooo| ETA: 00:00:00\r\e[0m\e[31m298/298: 100% |oooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:00\n\e[0m\nPending:\n\e[33m InfinityTest::Environment#environments should run in the scope of RVM environment\e[0m\n\e[90m # No reason given\e[0m\n\e[90m # \e[0m\n\nFinished in 0.43473 seconds\n\e[31m298 examples, 1 failure, 1 pending\e[0m\n")
88
- some_framework.message.should == "298 examples, 1 failure, 1 pending"
89
- end
90
-
91
- it "should raise error when not have patterns" do
92
- lambda {
93
- class Abc < TestFramework
94
- parse_results({})
95
- end
96
- }.should raise_exception(ArgumentError, 'patterns should not be empty')
97
- end
98
-
99
- end
100
-
101
- describe '#test_message' do
102
-
103
- it "should parse the message in the tests results" do
104
- some_framework.test_message("\n880 examples, 0 failures, 3 pending\n", { :example => /(\d+) example/}).should eql '880 examples, 0 failures, 3 pending'
105
- end
106
-
107
- it "should parse the message in the tests results" do
108
- some_framework.test_message("\n880 examples, 0 failures", { :pending => /(\d+) pending/, :example => /(\d+) example/ }).should eql '880 examples, 0 failures'
109
- end
110
-
111
- it "should parse the message in the tests results" do
112
- some_framework.test_message("\n880 examples, 0 failures", { :pending => /(\d+) pending/, :example => /(\d+) example/, :errors => /(\d+) errors/ }).should eql '880 examples, 0 failures'
113
- end
114
-
115
- it "should parse message when ==== is the last line" do
116
- some_framework.test_message("\n880 examples, 0 failures\n============", { :example => /(\d+) example/}).should == '880 examples, 0 failures'
117
- end
118
-
119
- it "should return nil when not have any patterns" do
120
- other_framework.test_message("NameError: You fail!! by Chuck Norris", { :pending => /(\d+) pending/, :example => /(\d+) example/ }).should be_nil
121
- end
122
-
123
- end
124
-
125
- end
126
-
127
- end
@@ -1,150 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module InfinityTest
4
- module TestLibrary
5
- describe Bacon do
6
- let(:current_env) { RVM.current }
7
-
8
- before do
9
- @current_dir = Dir.pwd
10
- end
11
-
12
- it "should be possible to set all rubies" do
13
- Bacon.new(:rubies => '1.9.1').rubies.should be == '1.9.1'
14
- end
15
-
16
- it "should set the rubies" do
17
- Bacon.new(:rubies => 'jruby,ree').rubies.should be == 'jruby,ree'
18
- end
19
-
20
- it "rubies should be empty when not have rubies" do
21
- Bacon.new.rubies.should be_empty
22
- end
23
-
24
- it 'should set a default test pattern when have none' do
25
- Bacon.new.test_pattern.should == 'spec/**/*_spec.rb'
26
- end
27
-
28
- it "should return false for #pending method" do
29
- Bacon.new.pending?.should be_false
30
- end
31
-
32
- describe '#test_files' do
33
-
34
- let(:bacon) { Bacon.new }
35
-
36
- it "return should include the spec files" do
37
- Dir.chdir("#{@current_dir}/spec/factories/buzz") do
38
- bacon.test_files.should be == "spec/buzz_spec.rb"
39
- end
40
- end
41
-
42
- it "return should include the spec files to test them" do
43
- Dir.chdir("#{@current_dir}/spec/factories/wood") do
44
- bacon.test_files.should be == "spec/wood_spec.rb"
45
- end
46
- end
47
-
48
- it "return should include the spec files to test them in two level of the spec folder" do
49
- Dir.chdir("#{@current_dir}/spec/factories/slinky") do
50
- bacon.test_files.should be == "spec/slinky/slinky_spec.rb"
51
- end
52
- end
53
-
54
- end
55
-
56
- describe '#decide_files' do
57
-
58
- before { @bacon = Bacon.new }
59
-
60
- it "should not call the spec file when match pattern" do
61
- @bacon.should_not_receive(:test_files)
62
- @bacon.decide_files('application_spec.rb')
63
- end
64
-
65
- it "should call the spec files when pattern is nil" do
66
- @bacon.should_receive(:test_files)
67
- @bacon.decide_files(nil)
68
- end
69
-
70
- end
71
-
72
- describe '#handle_results' do
73
-
74
- before do
75
- @bacon = Bacon.new
76
- end
77
-
78
- it "should handle a example that succeed" do
79
- results = "should be true\n\n2 specifications (2 requirements), 0 failures, 0 errors\n"
80
- @bacon.parse_results(results)
81
- @bacon.message.should == "2 specifications (2 requirements), 0 failures, 0 errors"
82
- end
83
-
84
- it "should parse without the terminal ansi color" do
85
- results = "should be true\n\n3 specifications (2 requirements), 0 failures, 0 errors\n"
86
- @bacon.parse_results(results)
87
- @bacon.message.should == "3 specifications (2 requirements), 0 failures, 0 errors"
88
- end
89
-
90
- it "should handle a example that succeed and return false for failure?" do
91
- results = "3 specifications (2 requirements), 0 failures, 0 errors"
92
- @bacon.parse_results(results)
93
- @bacon.failure?.should equal false
94
- end
95
-
96
- it "should parse without the terminal ansi color and grep the failure" do
97
- results = "\n\e[33m3 specifications (2 requirements), 10 failures, 0 errors\e[0m\n"
98
- @bacon.parse_results(results)
99
- @bacon.failure?.should be_true
100
- end
101
-
102
- it "should parse bacon tests errors" do
103
- results = "/Users/tomas/.rvm/gems/ruby-1.9.2@infinity_test/gems/my_class/bin/klass:2:in `require': no such file to load -- MyClass (LoadError)"
104
- @bacon.parse_results(results)
105
- @bacon.message.should == "An exception occurred"
106
- end
107
-
108
- it "should parse bacon tests errors" do
109
- results = "/Users/tomas/.rvm/gems/ruby-1.9.2@infinity_test/gems/my_class/bin/klass:2:in `require': no such file to load -- MyClass (LoadError)"
110
- @bacon.parse_results(results)
111
- @bacon.failure?.should be_true
112
- end
113
-
114
- it "should parse bacon tests errors" do
115
- results = "/Users/tomas/.rvm/gems/ruby-1.9.2@infinity_test/gems/my_class/bin/klass:2:in `require': no such file to load -- MyClass (LoadError)"
116
- @bacon.parse_results(results)
117
- @bacon.sucess?.should equal false
118
- end
119
- end
120
-
121
- describe '#sucess?' do
122
- before { @bacon = Bacon.new }
123
-
124
- it "should return false when have failures" do
125
- results = "3 specifications (3 requirements), 3 failures, 0 errors"
126
- @bacon.parse_results(results)
127
- @bacon.sucess?.should equal false
128
- end
129
-
130
- it "should return true when have zero failures and zero pending" do
131
- results = "13 specifications (20 requirements), 0 failures, 0 errors"
132
- @bacon.parse_results(results)
133
- @bacon.sucess?.should be_true
134
- end
135
-
136
- end
137
-
138
- describe '#search_bacon' do
139
- # humm ... Bacon ... nhame nhame =]
140
-
141
- it "should match bacon in the string" do
142
- current_env.should_receive(:path_for).and_return('bacon')
143
- Bacon.new.search_bacon(current_env).should match /bacon/
144
- end
145
-
146
- end
147
-
148
- end
149
- end
150
- end
@@ -1,8 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module InfinityTest
4
- module TestLibrary
5
- describe TestLibrary::Cucumber do
6
- end
7
- end
8
- end
@@ -1,189 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module InfinityTest
4
- module TestLibrary
5
- describe Rspec do
6
- let(:rspec) { Rspec.new }
7
-
8
- before do
9
- @current_dir = Dir.pwd
10
- end
11
-
12
- it "should be possible to set all rubies" do
13
- Rspec.new(:rubies => '1.9.1').rubies.should be == '1.9.1'
14
- end
15
-
16
- it "should set the rubies" do
17
- Rspec.new(:rubies => 'jruby,ree').rubies.should be == 'jruby,ree'
18
- end
19
-
20
- it "should set specific options" do
21
- Rspec.new(:specific_options => {'jruby' => '-J-cp bar/whisky-in-the.jar:.'}).specific_options.should == {'jruby' => '-J-cp bar/whisky-in-the.jar:.'}
22
- end
23
-
24
- it "rubies should be empty when not have rubies" do
25
- Rspec.new.rubies.should be_empty
26
- end
27
-
28
- it 'should set a default test pattern when have none' do
29
- Rspec.new.test_pattern.should == 'spec/**/*_spec.rb'
30
- end
31
-
32
- describe '#test_files' do
33
-
34
- it "return should include the spec files" do
35
- buzz_library do
36
- rspec.test_files.should be == "spec/buzz_spec.rb"
37
- end
38
- end
39
-
40
- it "return should include the spec files to test them" do
41
- wood_library do
42
- rspec.test_files.should be == "spec/wood_spec.rb"
43
- end
44
- end
45
-
46
- it "return should include the spec files to test them in two level of the spec folder" do
47
- slinky_library do
48
- rspec.test_files.should be == "spec/slinky/slinky_spec.rb"
49
- end
50
- end
51
-
52
- end
53
-
54
- describe '#decide_files' do
55
-
56
- before { @rspec = Rspec.new }
57
-
58
- it "should not call the spec file when match pattern" do
59
- @rspec.should_not_receive(:test_files)
60
- @rspec.decide_files('application_spec.rb')
61
- end
62
-
63
- it "should call the spec files when pattern is nil" do
64
- @rspec.should_receive(:test_files)
65
- @rspec.decide_files(nil)
66
- end
67
-
68
- end
69
-
70
- describe '#handle_results' do
71
-
72
- before do
73
- @rspec = Rspec.new
74
- end
75
-
76
- it "should handle a example that succeed" do
77
- results = "........Finished in 0.299817 seconds\n\n105 examples, 0 failures, 0 pending\n"
78
- @rspec.parse_results(results)
79
- @rspec.message.should == "105 examples, 0 failures, 0 pending"
80
- end
81
-
82
- it "should parse without the terminal ansi color" do
83
- results = "ork\e[0m\n\e[90m # No reason given\e[0m\n\e[90m # ./spec/infinity_test/configuration_spec.rb:31\e[0m\n\nFinished in 0.10487 seconds\n\e[33m406 examples, 5 failures, 2 pending\e[0m\n"
84
- @rspec.parse_results(results)
85
- @rspec.message.should == "406 examples, 5 failures, 2 pending"
86
- end
87
-
88
- it "should handle a example that succeed and return false for failure?" do
89
- results = "........Finished in 0.299817 seconds\n\n105 examples, 0 failures, 0 pending\n"
90
- @rspec.parse_results(results)
91
- @rspec.failure?.should equal false
92
- end
93
-
94
- it "should parse without the terminal ansi color and grep the failure" do
95
- results = "ork\e[0m\n\e[90m # No reason given\e[0m\n\e[90m # ./spec/infinity_test/configuration_spec.rb:31\e[0m\n\nFinished in 0.10487 seconds\n\e[33m406 examples, 5 failures, 2 pending\e[0m\n"
96
- @rspec.parse_results(results)
97
- @rspec.failure?.should be_true
98
- end
99
-
100
- it "should parse without the terminal ansi color and grep the pending" do
101
- results = "ork\e[0m\n\e[90m # No reason given\e[0m\n\e[90m # ./spec/infinity_test/configuration_spec.rb:31\e[0m\n\nFinished in 0.10487 seconds\n\e[33m406 examples, 0 failures, 2 pending\e[0m\n"
102
- @rspec.parse_results(results)
103
- @rspec.pending?.should be_true
104
- end
105
-
106
- it "should parse rspec tests errors" do
107
- results = "/Users/tomas/.rvm/gems/ruby-1.9.2@infinity_test/gems/my_class/bin/klass:2:in `require': no such file to load -- MyClass (LoadError)"
108
- @rspec.parse_results(results)
109
- @rspec.message.should == "An exception occurred"
110
- end
111
-
112
- it "should parse rspec tests errors" do
113
- results = "/Users/tomas/.rvm/gems/ruby-1.9.2@infinity_test/gems/my_class/bin/klass:2:in `require': no such file to load -- MyClass (LoadError)"
114
- @rspec.parse_results(results)
115
- @rspec.failure?.should be_true
116
- end
117
-
118
- it "should parse rspec tests errors" do
119
- results = "/Users/tomas/.rvm/gems/ruby-1.9.2@infinity_test/gems/my_class/bin/klass:2:in `require': no such file to load -- MyClass (LoadError)"
120
- @rspec.parse_results(results)
121
- @rspec.sucess?.should equal false
122
- end
123
-
124
- it "should parse rspec tests errors" do
125
- results = "/Users/tomas/.rvm/gems/ruby-1.9.2@infinity_test/gems/my_class/bin/klass:2:in `require': no such file to load -- MyClass (LoadError)"
126
- @rspec.parse_results(results)
127
- @rspec.pending?.should equal false
128
- end
129
- end
130
-
131
- describe '#sucess?' do
132
- before { @rspec = Rspec.new }
133
-
134
- it "should return false when have failures" do
135
- results = "ork\e[0m\n\e[90m # No reason given\e[0m\n\e[90m # ./spec/infinity_test/configuration_spec.rb:31\e[0m\n\nFinished in 0.10487 seconds\n\e[33m406 examples, 5 failures, 2 pending\e[0m\n"
136
- @rspec.parse_results(results)
137
- @rspec.sucess?.should equal false
138
- end
139
-
140
- it "should return false when have pending" do
141
- results = "ork\e[0m\n\e[90m # No reason given\e[0m\n\e[90m # ./spec/infinity_test/configuration_spec.rb:31\e[0m\n\nFinished in 0.10487 seconds\n\e[33m806 examples, 0 failures, 2 pending\e[0m\n"
142
- @rspec.parse_results(results)
143
- @rspec.sucess?.should be_false
144
- end
145
-
146
- it "should return true when have zero failures and zero pending" do
147
- results = "........Finished in 0.299817 seconds\n\n105 examples, 0 failures, 0 pending\n"
148
- @rspec.parse_results(results)
149
- @rspec.sucess?.should be_true
150
- end
151
-
152
- end
153
-
154
- describe '#pending?' do
155
- let(:rspec) { Rspec.new }
156
-
157
- it "should return true when have pending" do
158
- rspec.pending = 1
159
- rspec.failures = 0
160
- rspec.pending?.should be_true
161
- end
162
-
163
- it "should return false when have pending bu thave failures" do
164
- rspec.pending = 1
165
- rspec.failures = 1
166
- rspec.pending?.should equal false
167
- end
168
-
169
- end
170
-
171
- describe '#search_files' do
172
-
173
- it "should return all the files the match the pattern" do
174
- wood_library do
175
- rspec.search_files('wood').should be == "spec/wood_spec.rb"
176
- end
177
- end
178
-
179
- it "should return the files match by the pattern" do
180
- buzz_library do
181
- rspec.search_files('buzz').should be == 'spec/buzz_spec.rb'
182
- end
183
- end
184
-
185
- end
186
-
187
- end
188
- end
189
- end