infinity_test 0.1.0 → 0.2.0
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.
- data/.infinity_test +2 -2
- data/Gemfile +1 -3
- data/Gemfile.lock +22 -0
- data/History.markdown +44 -0
- data/Readme.markdown +4 -6
- data/VERSION.yml +1 -1
- data/infinity_test.gemspec +6 -5
- data/lib/infinity_test/application.rb +31 -9
- data/lib/infinity_test/command.rb +9 -2
- data/lib/infinity_test/configuration.rb +77 -13
- data/spec/infinity_test/application_spec.rb +45 -1
- data/spec/infinity_test/command_spec.rb +7 -0
- data/spec/infinity_test/configuration_spec.rb +105 -50
- data/spec/spec_helper.rb +9 -0
- metadata +6 -8
- data/features/infinity_test.feature +0 -36
- data/features/support/env.rb +0 -1
data/.infinity_test
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
infinity_test do
|
4
|
-
|
5
|
-
use :rubies => ['1.8.7', '1.9.2', 'jruby
|
4
|
+
|
5
|
+
use :rubies => ['1.8.7', '1.9.2', 'jruby', 'ree'], :gemset => 'infinity_test', :test_framework => :rspec
|
6
6
|
|
7
7
|
end
|
8
8
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
rspec (2.0.0.beta.22)
|
6
|
+
rspec-core (= 2.0.0.beta.22)
|
7
|
+
rspec-expectations (= 2.0.0.beta.22)
|
8
|
+
rspec-mocks (= 2.0.0.beta.22)
|
9
|
+
rspec-core (2.0.0.beta.22)
|
10
|
+
rspec-expectations (2.0.0.beta.22)
|
11
|
+
diff-lcs (>= 1.1.2)
|
12
|
+
rspec-mocks (2.0.0.beta.22)
|
13
|
+
rspec-core (= 2.0.0.beta.22)
|
14
|
+
rspec-expectations (= 2.0.0.beta.22)
|
15
|
+
watchr (0.7)
|
16
|
+
|
17
|
+
PLATFORMS
|
18
|
+
ruby
|
19
|
+
|
20
|
+
DEPENDENCIES
|
21
|
+
rspec (>= 2.0.0.beta.20)
|
22
|
+
watchr
|
data/History.markdown
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
Master Branch (in development)
|
2
|
+
==============================
|
3
|
+
|
4
|
+
Features
|
5
|
+
--------
|
6
|
+
|
7
|
+
- Make possible to run callbacks in each ruby.
|
8
|
+
|
9
|
+
Example:
|
10
|
+
|
11
|
+
# ~/.infinity_test or ./.infinity_test
|
12
|
+
infinity_test do
|
13
|
+
before(:each_ruby) do |environment|
|
14
|
+
environment.ruby('some_ruby_file') # run a ruby file in each ruby that you setup
|
15
|
+
environment.rake('Rakefile', 'compile') # run rake compile in each ruby that you setup
|
16
|
+
end
|
17
|
+
|
18
|
+
after(:each_ruby) do |environment|
|
19
|
+
...
|
20
|
+
end
|
21
|
+
|
22
|
+
before(:all) do
|
23
|
+
clear :terminal
|
24
|
+
end
|
25
|
+
|
26
|
+
after(:all) do
|
27
|
+
...
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
Bugfix
|
32
|
+
------
|
33
|
+
|
34
|
+
* When not have notifications framework do nothing instead raise an Exception (thanks to Nelson Minor Haraguchi)
|
35
|
+
* When you don't use a block in #notifications method in .infinity_test, then Infinity Test will use the simpson default images
|
36
|
+
|
37
|
+
v0.1.0
|
38
|
+
======
|
39
|
+
|
40
|
+
* Support Rspec 2 or Rspec 1.3.
|
41
|
+
* Put some images to show in the notifications.
|
42
|
+
* Create the hooks in before all the test and after all tests.
|
43
|
+
* Create the notifications DSL for the .infinity_test file.
|
44
|
+
* Possible to run with Test::Unit or Rspec with RVM.
|
data/Readme.markdown
CHANGED
@@ -14,9 +14,7 @@ giving the possibility to test with all <b>Rubies</b> that you have in your RVM
|
|
14
14
|
|
15
15
|
## Install
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
This gem will be released in September 17.
|
17
|
+
gem install infinity_test
|
20
18
|
|
21
19
|
## Running Tests only in one ruby
|
22
20
|
|
@@ -64,12 +62,12 @@ So create the global file or project file called:
|
|
64
62
|
end
|
65
63
|
|
66
64
|
after_run do
|
67
|
-
|
65
|
+
... some code
|
68
66
|
end
|
69
67
|
|
70
68
|
end
|
71
69
|
|
72
|
-
|
70
|
+
## Customize the .infinity_test file
|
73
71
|
|
74
72
|
#### If you want to customize and understand the .infinity_test file, <a href='http://github.com/tomas-stefano/infinity_test/wiki/Customize-Infinity-Test'>Read this Page</a>
|
75
73
|
|
@@ -83,8 +81,8 @@ So create the global file or project file called:
|
|
83
81
|
|
84
82
|
## TODO
|
85
83
|
|
86
|
-
* Edit the wiki
|
87
84
|
* Working in focus files and run only the modified file (Strategies for Test::Unit, Rspec and Cucumber)
|
85
|
+
* Working in support Rails applications (Sinatra/Rack/Padrino too!)
|
88
86
|
|
89
87
|
# Acknowledgments
|
90
88
|
|
data/VERSION.yml
CHANGED
data/infinity_test.gemspec
CHANGED
@@ -5,20 +5,23 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{infinity_test}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tomas D'Stefano"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-29}
|
13
|
+
s.default_executable = %q{infinity_test}
|
13
14
|
s.description = %q{Infinity Test is a continuous testing library and a flexible alternative to Autotest, using Watchr library with Rspec OR Test::Unit with RVM funcionality, giving the possibility to test with all Rubies that you have in your RVM configuration.}
|
14
15
|
s.email = %q{tomasdestefi@gmail.com}
|
15
|
-
s.executables = ["infinity_test"
|
16
|
+
s.executables = ["infinity_test"]
|
16
17
|
s.files = [
|
17
18
|
".gitignore",
|
18
19
|
".infinity_test",
|
19
20
|
".rspec",
|
20
21
|
".rvmrc",
|
21
22
|
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"History.markdown",
|
22
25
|
"Rakefile",
|
23
26
|
"Readme.markdown",
|
24
27
|
"Tasks",
|
@@ -27,8 +30,6 @@ Gem::Specification.new do |s|
|
|
27
30
|
"buzz_images/buzz_lightyear.jpg",
|
28
31
|
"buzz_images/buzz_lightyear_continencia.gif",
|
29
32
|
"buzz_images/to_infinity_and_beyond.png",
|
30
|
-
"features/infinity_test.feature",
|
31
|
-
"features/support/env.rb",
|
32
33
|
"images/faces/failure.png",
|
33
34
|
"images/faces/pending.png",
|
34
35
|
"images/faces/sucess.png",
|
@@ -56,6 +56,14 @@ module InfinityTest
|
|
56
56
|
config.after_callback
|
57
57
|
end
|
58
58
|
|
59
|
+
def before_each_ruby_callback
|
60
|
+
config.before_each_ruby_callback
|
61
|
+
end
|
62
|
+
|
63
|
+
def after_each_ruby_callback
|
64
|
+
config.after_each_ruby_callback
|
65
|
+
end
|
66
|
+
|
59
67
|
# Return the rubies setting in the config file or the command line
|
60
68
|
#
|
61
69
|
def rubies
|
@@ -85,17 +93,21 @@ module InfinityTest
|
|
85
93
|
def run!(commands)
|
86
94
|
before_callback.call if before_callback
|
87
95
|
commands.each do |ruby_version, command|
|
88
|
-
|
89
|
-
|
90
|
-
command = Command.new(:ruby_version => ruby_version, :command => command).run!
|
96
|
+
call_each_ruby_callback(:before_each_ruby_callback, ruby_version)
|
97
|
+
command = say_the_ruby_version_and_run_the_command!(ruby_version, command) # This method exist because it's more easier to test
|
91
98
|
notify!(:results => command.results, :ruby_version => ruby_version)
|
99
|
+
call_each_ruby_callback(:after_each_ruby_callback, ruby_version)
|
92
100
|
end
|
93
101
|
after_callback.call if after_callback
|
94
102
|
end
|
95
103
|
|
96
104
|
def notify!(options)
|
97
|
-
|
98
|
-
|
105
|
+
if notification_framework
|
106
|
+
message = parse_results(options[:results])
|
107
|
+
notification_framework.notify(:title => options[:ruby_version], :message => message, :image => image_to_show)
|
108
|
+
else
|
109
|
+
# skip(do nothing) when not have notification framework
|
110
|
+
end
|
99
111
|
end
|
100
112
|
|
101
113
|
def parse_results(results)
|
@@ -133,6 +145,17 @@ module InfinityTest
|
|
133
145
|
|
134
146
|
private
|
135
147
|
|
148
|
+
def call_each_ruby_callback(callback_type, ruby_version)
|
149
|
+
callback = send(callback_type)
|
150
|
+
callback.call(RVM::Environment.new(ruby_version)) if callback
|
151
|
+
end
|
152
|
+
|
153
|
+
def say_the_ruby_version_and_run_the_command!(ruby_version, command)
|
154
|
+
puts; puts "* { :ruby => #{ruby_version} }"
|
155
|
+
puts command if verbose?
|
156
|
+
Command.new(:ruby_version => ruby_version, :command => command).run!
|
157
|
+
end
|
158
|
+
|
136
159
|
def setting_test_framework
|
137
160
|
case config.test_framework
|
138
161
|
when :rspec
|
@@ -152,15 +175,14 @@ module InfinityTest
|
|
152
175
|
end
|
153
176
|
|
154
177
|
def load_global_configuration
|
155
|
-
load_file
|
178
|
+
load_file(File.expand_path('~/.infinity_test'))
|
156
179
|
end
|
157
180
|
|
158
181
|
def load_project_configuration
|
159
|
-
load_file
|
182
|
+
load_file('./.infinity_test')
|
160
183
|
end
|
161
184
|
|
162
|
-
def load_file(
|
163
|
-
file = options[:file]
|
185
|
+
def load_file(file)
|
164
186
|
load(file) if File.exist?(file)
|
165
187
|
end
|
166
188
|
|
@@ -34,11 +34,12 @@ module InfinityTest
|
|
34
34
|
end
|
35
35
|
|
36
36
|
# Push in the results the test line
|
37
|
-
# If have in the Ruby Enterpise Edition pack the numbers
|
37
|
+
# If have in the Ruby Enterpise Edition or Ruby 1.8.* pack the numbers returned.
|
38
|
+
# Join otherwise.
|
38
39
|
#
|
39
40
|
def push_in_the_results(test_line)
|
40
41
|
if end_of_line?(test_line)
|
41
|
-
@results.push(ree? ? @line.pack('c*') : @line.join)
|
42
|
+
@results.push((ree? or mri?) ? @line.pack('c*') : @line.join)
|
42
43
|
@line.clear
|
43
44
|
end
|
44
45
|
end
|
@@ -49,6 +50,12 @@ module InfinityTest
|
|
49
50
|
RVM::Environment.current_ruby_string =~ /ree/
|
50
51
|
end
|
51
52
|
|
53
|
+
# Using mri?
|
54
|
+
#
|
55
|
+
def mri?
|
56
|
+
RVM::Environment.current_ruby_string =~ /ruby-1.8/
|
57
|
+
end
|
58
|
+
|
52
59
|
def end_of_line?(test_line)
|
53
60
|
test_line == ?\n
|
54
61
|
end
|
@@ -3,20 +3,29 @@ module InfinityTest
|
|
3
3
|
|
4
4
|
SUPPORTED_FRAMEWORKS = [:growl, :lib_notify] # :snarl, :lib_notify
|
5
5
|
|
6
|
-
attr_accessor :notification_framework,
|
7
|
-
:
|
6
|
+
attr_accessor :notification_framework,
|
7
|
+
:sucess_image, :failure_image, :pending_image,
|
8
|
+
:rubies, :test_framework,
|
9
|
+
:exceptions_to_ignore,
|
10
|
+
:before_callback, :before_each_ruby_callback,
|
11
|
+
:after_callback, :after_each_ruby_callback,
|
12
|
+
:verbose
|
8
13
|
|
9
14
|
IMAGES_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'images'))
|
10
15
|
|
16
|
+
SUCESS = 'sucess'
|
17
|
+
FAILURE = 'failure'
|
18
|
+
PENDING = 'pending'
|
19
|
+
|
11
20
|
# Initialize the Configuration object that keeps the images, callbacks, rubies
|
12
21
|
# and the test framework
|
13
22
|
#
|
14
23
|
def initialize
|
15
24
|
@default_dir_image = File.join(IMAGES_DIR, 'simpson')
|
16
|
-
@sucess_image = 'sucess'
|
17
|
-
@failure_image = 'failure'
|
18
|
-
@pending_image = 'pending'
|
19
25
|
@test_framework = :test_unit
|
26
|
+
@sucess_image = search_image(SUCESS)
|
27
|
+
@failure_image = search_image(FAILURE)
|
28
|
+
@pending_image = search_image(PENDING)
|
20
29
|
@verbose = false
|
21
30
|
end
|
22
31
|
|
@@ -32,6 +41,8 @@ module InfinityTest
|
|
32
41
|
# # block
|
33
42
|
# end
|
34
43
|
#
|
44
|
+
# notifications :lib_notify
|
45
|
+
#
|
35
46
|
def notifications(framework, &block)
|
36
47
|
raise NotificationFrameworkDontSupported, "Notification :#{framework} don't supported. The Frameworks supported are: #{SUPPORTED_FRAMEWORKS.join(',')}" unless SUPPORTED_FRAMEWORKS.include?(framework)
|
37
48
|
@notification_framework = framework
|
@@ -54,9 +65,9 @@ module InfinityTest
|
|
54
65
|
#
|
55
66
|
def show_images(options={})
|
56
67
|
switch_mode!(options[:mode]) if options[:mode]
|
57
|
-
@sucess_image =
|
58
|
-
@failure_image =
|
59
|
-
@pending_image =
|
68
|
+
@sucess_image = options[:sucess] || search_image(SUCESS)
|
69
|
+
@failure_image = options[:failure] || search_image(FAILURE)
|
70
|
+
@pending_image = options[:pending] || search_image(PENDING)
|
60
71
|
end
|
61
72
|
|
62
73
|
# Switch the image directory to show
|
@@ -70,10 +81,6 @@ module InfinityTest
|
|
70
81
|
end
|
71
82
|
end
|
72
83
|
|
73
|
-
def setting_image(image)
|
74
|
-
image unless image.equal?(:default)
|
75
|
-
end
|
76
|
-
|
77
84
|
# Search the sucess, failure or pending images and return the first in the pattern
|
78
85
|
#
|
79
86
|
def search_image(file)
|
@@ -97,7 +104,9 @@ module InfinityTest
|
|
97
104
|
@test_framework = options[:test_framework] || @test_framework
|
98
105
|
@verbose = options[:verbose] || @verbose
|
99
106
|
if options[:gemset]
|
100
|
-
@rubies = @rubies.split(',').collect { |ruby|
|
107
|
+
@rubies = @rubies.split(',').collect { |ruby|
|
108
|
+
ruby << "@#{options[:gemset]}"
|
109
|
+
}.join(',')
|
101
110
|
end
|
102
111
|
end
|
103
112
|
|
@@ -138,11 +147,66 @@ module InfinityTest
|
|
138
147
|
@after_callback = block
|
139
148
|
end
|
140
149
|
|
150
|
+
# Callback method to handle before or after all run and for each ruby too!
|
151
|
+
#
|
152
|
+
# Example:
|
153
|
+
#
|
154
|
+
# before(:all) do
|
155
|
+
# clear :terminal
|
156
|
+
# end
|
157
|
+
#
|
158
|
+
# before(:each_ruby) do
|
159
|
+
# ...
|
160
|
+
# end
|
161
|
+
#
|
162
|
+
# Or if you pass not then will use :all option
|
163
|
+
#
|
164
|
+
# before do
|
165
|
+
# clear :terminal
|
166
|
+
# end
|
167
|
+
#
|
168
|
+
#
|
169
|
+
def before(hook=:all, &block)
|
170
|
+
setting_callback(hook, :all => :@before_callback, :each_ruby => :@before_each_ruby_callback, &block)
|
171
|
+
end
|
172
|
+
|
173
|
+
# Callback method to handle before or after all run and for each ruby too!
|
174
|
+
#
|
175
|
+
# Example:
|
176
|
+
#
|
177
|
+
# after(:all) do
|
178
|
+
# clear :terminal
|
179
|
+
# end
|
180
|
+
#
|
181
|
+
# after(:each_ruby) do
|
182
|
+
# ...
|
183
|
+
# end
|
184
|
+
#
|
185
|
+
# Or if you pass not then will use :all option
|
186
|
+
#
|
187
|
+
# after do
|
188
|
+
# clear :terminal
|
189
|
+
# end
|
190
|
+
#
|
191
|
+
def after(hook=:all, &block)
|
192
|
+
setting_callback(hook, :all => :@after_callback, :each_ruby => :@after_each_ruby_callback, &block)
|
193
|
+
end
|
194
|
+
|
141
195
|
# Clear the terminal (Useful in the before callback)
|
142
196
|
#
|
143
197
|
def clear(option)
|
144
198
|
system('clear') if option == :terminal
|
145
199
|
end
|
200
|
+
|
201
|
+
private
|
202
|
+
|
203
|
+
def setting_callback(hook, callback, &block)
|
204
|
+
if hook == :all
|
205
|
+
instance_variable_set(callback[:all], block)
|
206
|
+
elsif hook == :each_ruby
|
207
|
+
instance_variable_set(callback[:each_ruby], block)
|
208
|
+
end
|
209
|
+
end
|
146
210
|
|
147
211
|
end
|
148
212
|
end
|
@@ -145,5 +145,49 @@ module InfinityTest
|
|
145
145
|
|
146
146
|
end
|
147
147
|
|
148
|
+
describe '#notify!' do
|
149
|
+
|
150
|
+
it "should do nothing when not have notification framework" do
|
151
|
+
application.should_receive(:notification_framework).and_return(nil)
|
152
|
+
application.notify!(:results => '0 examples', :ruby_version => '1.9.2').should be_nil
|
153
|
+
end
|
154
|
+
|
155
|
+
it "should notify when have notification framework" do
|
156
|
+
application.config.notifications :growl
|
157
|
+
application.notification_framework.should_receive(:notify)
|
158
|
+
application.notify!(:results => '0 examples', :ruby_version => '1.8.7')
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
describe '#run!' do
|
164
|
+
let(:block) { Proc.new { 'w00t!' } }
|
165
|
+
|
166
|
+
it 'should call the before all callback' do
|
167
|
+
application_with_rspec.config.before(&block)
|
168
|
+
application_with_rspec.before_callback.should_receive(:call)
|
169
|
+
run_the_command(application_with_rspec)
|
170
|
+
end
|
171
|
+
|
172
|
+
it "should call the after all callback" do
|
173
|
+
application_with_rspec.config.after(&block)
|
174
|
+
application_with_rspec.after_callback.should_receive(:call)
|
175
|
+
run_the_command(application_with_rspec)
|
176
|
+
end
|
177
|
+
|
178
|
+
it "should call the before each ruby callback" do
|
179
|
+
application_with_rspec.config.before(:each_ruby, &block)
|
180
|
+
application_with_rspec.before_each_ruby_callback.should_receive(:call)
|
181
|
+
run_the_command(application_with_rspec)
|
182
|
+
end
|
183
|
+
|
184
|
+
it "should call the after each ruby callback" do
|
185
|
+
application_with_rspec.config.after(:each_ruby, &block)
|
186
|
+
application_with_rspec.after_each_ruby_callback.should_receive(:call)
|
187
|
+
run_the_command(application_with_rspec)
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
191
|
+
|
148
192
|
end
|
149
|
-
end
|
193
|
+
end
|
@@ -40,6 +40,13 @@ module InfinityTest
|
|
40
40
|
@command.results.should == ["\e[33m121 examples, 0 failures, 2 pending\e[0m\n"]
|
41
41
|
end
|
42
42
|
|
43
|
+
it "should parse correct the results in ruby 1.8" do
|
44
|
+
@command.line = [46, 46, 46, 46, 46, 42, 46, 42]
|
45
|
+
@command.should_receive(:ree?).and_return(false)
|
46
|
+
@command.should_receive(:mri?).and_return(true)
|
47
|
+
@command.push_in_the_results(?\n)
|
48
|
+
@command.results.should == [".....*.*"]
|
49
|
+
end
|
43
50
|
|
44
51
|
end
|
45
52
|
|
@@ -4,7 +4,8 @@ module InfinityTest
|
|
4
4
|
describe Configuration do
|
5
5
|
before { @config = Configuration.new }
|
6
6
|
let(:config) { @config }
|
7
|
-
|
7
|
+
let(:block) { Proc.new { 'To Infinity and beyond!' } }
|
8
|
+
|
8
9
|
describe '#initialize' do
|
9
10
|
|
10
11
|
it "should set the test_unit as default test framework" do
|
@@ -116,60 +117,56 @@ module InfinityTest
|
|
116
117
|
|
117
118
|
before { @config = Configuration.new }
|
118
119
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
@config.
|
123
|
-
|
120
|
+
let(:config) { @config }
|
121
|
+
|
122
|
+
context 'on default images' do
|
123
|
+
before { @config.notifications :growl }
|
124
|
+
|
125
|
+
it { config.sucess_image.should == image('simpson/sucess.jpg') }
|
126
|
+
|
127
|
+
it { config.pending_image.should == image('simpson/pending.jpg') }
|
128
|
+
|
129
|
+
it { config.failure_image.should == image('simpson/failure.gif') }
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
context 'on setting my own image' do
|
134
|
+
before { config.notifications :lib_notify }
|
135
|
+
|
136
|
+
it "should be possible to customize success image" do
|
137
|
+
config.show_images :sucess => image('other.png')
|
138
|
+
config.sucess_image.should == image('other.png')
|
139
|
+
end
|
124
140
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
end
|
141
|
+
it "should be possible to customize failure image" do
|
142
|
+
config.show_images :failure => image('failure_picture.png')
|
143
|
+
config.failure_image.should == image('failure_picture.png')
|
144
|
+
end
|
130
145
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
end
|
146
|
+
it "should be possible to customize failure image" do
|
147
|
+
config.show_images :pending => image('pending_picture.png')
|
148
|
+
config.pending_image.should == image('pending_picture.png')
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
context 'setting the dirrectory image or modes' do
|
153
|
+
before { config.notifications :growl }
|
154
|
+
|
155
|
+
it "should possible to change the dir of images" do
|
156
|
+
config.show_images :mode => :street_fighter
|
157
|
+
config.pending_image.should == image('street_fighter/pending.gif')
|
158
|
+
end
|
136
159
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
end
|
160
|
+
it "should possible to change the dir of the images" do
|
161
|
+
config.show_images :mode => :toy_story
|
162
|
+
config.sucess_image.should == image('toy_story/sucess.png')
|
163
|
+
end
|
142
164
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
165
|
+
it "should possible to change the dir of the images" do
|
166
|
+
config.show_images :mode => custom_image_dir
|
167
|
+
config.sucess_image.should == custom_image('images/sucess.png')
|
168
|
+
end
|
147
169
|
end
|
148
|
-
|
149
|
-
it "should be possible to customize failure image" do
|
150
|
-
@config.notifications :growl
|
151
|
-
@config.show_images :pending => image('pending_picture.png')
|
152
|
-
@config.pending_image.should == image('pending_picture.png')
|
153
|
-
end
|
154
|
-
|
155
|
-
it "should possible to change the dir of images" do
|
156
|
-
@config.notifications :growl
|
157
|
-
@config.show_images :mode => :street_fighter
|
158
|
-
@config.pending_image.should == image('street_fighter/pending.gif')
|
159
|
-
end
|
160
|
-
|
161
|
-
it "should possible to change the dir of the images" do
|
162
|
-
@config.notifications :growl
|
163
|
-
@config.show_images :mode => :street_fighter
|
164
|
-
@config.sucess_image.should == image('street_fighter/sucess.jpg')
|
165
|
-
end
|
166
|
-
|
167
|
-
it "should possible to change the dir of the images" do
|
168
|
-
@config.notifications :growl
|
169
|
-
@config.show_images :mode => custom_image_dir
|
170
|
-
@config.sucess_image.should == custom_image('images/sucess.png')
|
171
|
-
end
|
172
|
-
|
173
170
|
end
|
174
171
|
|
175
172
|
describe '#before_run' do
|
@@ -192,5 +189,63 @@ module InfinityTest
|
|
192
189
|
|
193
190
|
end
|
194
191
|
|
192
|
+
describe '#before' do
|
193
|
+
|
194
|
+
it "should set the before callback if pass not hook" do
|
195
|
+
config.before(&block)
|
196
|
+
config.before_callback.should == block
|
197
|
+
end
|
198
|
+
|
199
|
+
it "should possible to set the before_run block" do
|
200
|
+
config.before(:all, &block)
|
201
|
+
config.before_callback.should == block
|
202
|
+
end
|
203
|
+
|
204
|
+
it "should possible to set before each ruby block" do
|
205
|
+
config.before(:each_ruby, &block)
|
206
|
+
config.before_each_ruby_callback.should == block
|
207
|
+
end
|
208
|
+
|
209
|
+
it "should not set before_run block in :each_ruby option" do
|
210
|
+
config.before(:each_ruby, &block)
|
211
|
+
config.before_callback.should be_nil
|
212
|
+
end
|
213
|
+
|
214
|
+
it "should not set before_run block in :all option" do
|
215
|
+
config.before(:all, &block)
|
216
|
+
config.before_each_ruby_callback.should be_nil
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
describe '#after' do
|
222
|
+
|
223
|
+
it "should set the after callback if pass not hook" do
|
224
|
+
config.after(&block)
|
225
|
+
config.after_callback.should == block
|
226
|
+
end
|
227
|
+
|
228
|
+
it "should possible to set the after block" do
|
229
|
+
config.after(:all, &block)
|
230
|
+
config.after_callback.should == block
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should possible to set after each ruby block" do
|
234
|
+
config.after(:each_ruby, &block)
|
235
|
+
config.after_each_ruby_callback.should == block
|
236
|
+
end
|
237
|
+
|
238
|
+
it "should not set after block in :each_ruby option" do
|
239
|
+
config.after(:each_ruby, &block)
|
240
|
+
config.after_callback.should be_nil
|
241
|
+
end
|
242
|
+
|
243
|
+
it "should not set after each ruby block in :all option" do
|
244
|
+
config.after(:all, &block)
|
245
|
+
config.after_each_ruby_callback.should be_nil
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
249
|
+
|
195
250
|
end
|
196
251
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -65,3 +65,12 @@ require 'watchr'
|
|
65
65
|
def custom_image_dir
|
66
66
|
File.expand_path(File.join(File.dirname(__FILE__), 'factories', 'images'))
|
67
67
|
end
|
68
|
+
|
69
|
+
def run_the_command(app)
|
70
|
+
command = mock(InfinityTest::Command)
|
71
|
+
command.should_receive(:results).at_least(:once).and_return('0 examples, 0 failures')
|
72
|
+
app.should_receive(:say_the_ruby_version_and_run_the_command!).at_least(:once).and_return(command)
|
73
|
+
app.should_receive(:notify!).and_return(nil)
|
74
|
+
app.run!(['spec'])
|
75
|
+
end
|
76
|
+
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 2
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tomas D'Stefano
|
@@ -14,8 +14,8 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
18
|
-
default_executable:
|
17
|
+
date: 2010-09-29 00:00:00 -03:00
|
18
|
+
default_executable: infinity_test
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: watchr
|
@@ -80,7 +80,6 @@ description: Infinity Test is a continuous testing library and a flexible altern
|
|
80
80
|
email: tomasdestefi@gmail.com
|
81
81
|
executables:
|
82
82
|
- infinity_test
|
83
|
-
- infinity_test.compiled.rbc
|
84
83
|
extensions: []
|
85
84
|
|
86
85
|
extra_rdoc_files: []
|
@@ -91,6 +90,8 @@ files:
|
|
91
90
|
- .rspec
|
92
91
|
- .rvmrc
|
93
92
|
- Gemfile
|
93
|
+
- Gemfile.lock
|
94
|
+
- History.markdown
|
94
95
|
- Rakefile
|
95
96
|
- Readme.markdown
|
96
97
|
- Tasks
|
@@ -99,8 +100,6 @@ files:
|
|
99
100
|
- buzz_images/buzz_lightyear.jpg
|
100
101
|
- buzz_images/buzz_lightyear_continencia.gif
|
101
102
|
- buzz_images/to_infinity_and_beyond.png
|
102
|
-
- features/infinity_test.feature
|
103
|
-
- features/support/env.rb
|
104
103
|
- images/faces/failure.png
|
105
104
|
- images/faces/pending.png
|
106
105
|
- images/faces/sucess.png
|
@@ -168,7 +167,6 @@ files:
|
|
168
167
|
- spec/infinity_test_spec.rb
|
169
168
|
- spec/spec.opts
|
170
169
|
- spec/spec_helper.rb
|
171
|
-
- bin/infinity_test.compiled.rbc
|
172
170
|
has_rdoc: true
|
173
171
|
homepage: http://github.com/tomas-stefano/infinity_test
|
174
172
|
licenses: []
|
@@ -1,36 +0,0 @@
|
|
1
|
-
Feature: Infinity test
|
2
|
-
In order to continuous testing
|
3
|
-
As a user
|
4
|
-
I want to test my app/gem with rapid feedback
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given a file named "continuous/lib/continuous.rb" with:
|
8
|
-
"""
|
9
|
-
class Continuous
|
10
|
-
end
|
11
|
-
"""
|
12
|
-
And a file named "continuous/spec/continuous_spec.rb" with:
|
13
|
-
"""
|
14
|
-
require 'continuous'
|
15
|
-
describe Continuous do
|
16
|
-
it "should be true" do
|
17
|
-
Continuous.new.should be_true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
"""
|
21
|
-
And a file named "continuous/features/continuous.feature" with:
|
22
|
-
"""
|
23
|
-
"""
|
24
|
-
|
25
|
-
|
26
|
-
Scenario: Show help
|
27
|
-
When I run "ruby ../../bin/infinity_test --help"
|
28
|
-
Then I should see:
|
29
|
-
"""
|
30
|
-
Usage: infinity_test [options]
|
31
|
-
Starts a continuous test server.
|
32
|
-
--rspec Rspec Framework
|
33
|
-
--rvm-versions=rubies Specify the Ruby Versions for Testing with several Rubies
|
34
|
-
--help You're looking at it.
|
35
|
-
"""
|
36
|
-
|
data/features/support/env.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'aruba'
|