semi-autotest 0.1.3
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/LICENCE +21 -0
- data/LICENSE +21 -0
- data/README.rdoc +115 -0
- data/lib/semi-autotest.rb +50 -0
- data/lib/semi-autotest/version.rb +4 -0
- data/samples/simple/bacon/thing_spec.rb +11 -0
- data/samples/simple/lib/thing.rb +5 -0
- data/samples/simple/minitest/thing_test.rb +11 -0
- data/samples/simple/spec/spec_helper.rb +5 -0
- data/samples/simple/spec/thing_spec.rb +9 -0
- data/semi-autotest.gemspec +17 -0
- metadata +58 -0
data/LICENCE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT Licence
|
2
|
+
|
3
|
+
Copyright (c) 2011 Pistos
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT Licence
|
2
|
+
|
3
|
+
Copyright (c) 2011 Pistos
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
= Semi-AutoTest
|
2
|
+
|
3
|
+
== DESCRIPTION
|
4
|
+
|
5
|
+
Semi-AutoTest allows you to rapidly repeat a test or set of tests without waiting
|
6
|
+
for test preparation time before each test run.
|
7
|
+
|
8
|
+
== SYNOPSIS
|
9
|
+
|
10
|
+
Given an rspec file like:
|
11
|
+
|
12
|
+
# thing_spec.rb
|
13
|
+
require 'semi-autotest'
|
14
|
+
require 'thing'
|
15
|
+
|
16
|
+
describe 'The thing under test' do
|
17
|
+
it 'should do something' do
|
18
|
+
SemiAutoTest.repeat_from_here
|
19
|
+
Thing.do_something.should == "success"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Run one particular spec:
|
24
|
+
|
25
|
+
# rspec -e 'thing under test' spec/thing_spec.rb
|
26
|
+
semi>
|
27
|
+
|
28
|
+
Press Enter to run the spec once:
|
29
|
+
|
30
|
+
semi>
|
31
|
+
.
|
32
|
+
|
33
|
+
Finished in 0.45392 seconds
|
34
|
+
1 example, 0 failures
|
35
|
+
semi>
|
36
|
+
|
37
|
+
Start watching the code under test with the "w" command (tab completion supported):
|
38
|
+
|
39
|
+
semi> w lib/thing.rb
|
40
|
+
semi>
|
41
|
+
|
42
|
+
You could also accomplish the same thing with a line like this in your test code
|
43
|
+
(before calling #repeat_from_here):
|
44
|
+
|
45
|
+
SemiAutoTest.files_reloadable << 'lib/thing.rb'
|
46
|
+
|
47
|
+
Edit the code under test, and introduce a bug. Rerun the spec by pressing Enter:
|
48
|
+
|
49
|
+
semi>
|
50
|
+
F
|
51
|
+
|
52
|
+
Failures:
|
53
|
+
|
54
|
+
1) The thing under test should do something
|
55
|
+
Failure/Error: Thing.do_something.should == "success"
|
56
|
+
expected: "success"
|
57
|
+
got: "failure" (using ==)
|
58
|
+
# ./sample/spec/thing_spec.rb:8:in `block (2 levels) in <top (required)>'
|
59
|
+
|
60
|
+
Finished in 80.54 seconds
|
61
|
+
1 example, 1 failure
|
62
|
+
|
63
|
+
Failed examples:
|
64
|
+
|
65
|
+
rspec ./sample/spec/thing_spec.rb:6 # The thing under test should do something
|
66
|
+
semi>
|
67
|
+
|
68
|
+
List watched files with the "l" command:
|
69
|
+
|
70
|
+
semi> l
|
71
|
+
["lib/thing.rb"]
|
72
|
+
semi>
|
73
|
+
|
74
|
+
Stop watching files with the "u" command:
|
75
|
+
|
76
|
+
semi> u lib/thing.rb
|
77
|
+
semi>
|
78
|
+
|
79
|
+
Quit with the "q" command, or by pressing ^D on a blank input line. To
|
80
|
+
continue running until finished (and then quit afterwards), use the "c"
|
81
|
+
command.
|
82
|
+
|
83
|
+
== CAVEAT
|
84
|
+
|
85
|
+
Special care needs to be taken if you have tests that have cleanup or teardown
|
86
|
+
which have lasting effects, such as closure of handles (file, database, socket,
|
87
|
+
etc.) or persistence of data. If you encounter problems related to this,
|
88
|
+
experiment with different places from which to call #repeat_from_here -- it
|
89
|
+
often helps to call #repeat_from_here in a sooner/higher location in your spec,
|
90
|
+
and from within a "before :all" block.
|
91
|
+
|
92
|
+
When using a browser driver in your tests, it may be helpful to have a little
|
93
|
+
no-op broswer spec earlier than your actual spec. The purpose of this is to
|
94
|
+
open the browser before the spec of interest runs, and to keep the browser open
|
95
|
+
for further runs. Example no-op spec:
|
96
|
+
|
97
|
+
it 'should open the browser' do
|
98
|
+
visit '/'
|
99
|
+
end
|
100
|
+
|
101
|
+
== LICENCE
|
102
|
+
|
103
|
+
Semi-AutoTest is licensed under the MIT Licence. See the LICENCE file.
|
104
|
+
|
105
|
+
== CONTACT
|
106
|
+
|
107
|
+
The source code repository is at http://github.com/Pistos/semi-autotest .
|
108
|
+
|
109
|
+
Send comments, feedback and tech support requests to the #mathetes channel on
|
110
|
+
the FreeNode IRC network ( http://webchat.freenode.net/?channels=mathetes ).
|
111
|
+
Reproducible issues may be reported at
|
112
|
+
https://github.com/Pistos/semi-autotest/issues .
|
113
|
+
|
114
|
+
|
115
|
+
Pistos
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'pp'
|
2
|
+
require 'set'
|
3
|
+
require 'readline'
|
4
|
+
|
5
|
+
module SemiAutoTest
|
6
|
+
def self.files_reloadable
|
7
|
+
@files_reloadable ||= Set.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.reload_changed_files
|
11
|
+
files_reloadable.each do |f|
|
12
|
+
begin
|
13
|
+
load f
|
14
|
+
rescue Exception => e
|
15
|
+
$stderr.puts e.inspect
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.repeat_from_here
|
21
|
+
while command = Readline.readline( 'semi> ', true )
|
22
|
+
case command
|
23
|
+
when /^q/i
|
24
|
+
exit!
|
25
|
+
when /^c/i
|
26
|
+
break
|
27
|
+
when /^l/i
|
28
|
+
pp files_reloadable.to_a
|
29
|
+
when /^w(?:\S*) +(\S+)/i
|
30
|
+
files_reloadable << $1
|
31
|
+
when /^u(?:\S*) +(\S+)/i
|
32
|
+
files_reloadable.delete $1
|
33
|
+
when ""
|
34
|
+
reload_changed_files
|
35
|
+
|
36
|
+
# Run test(s) once.
|
37
|
+
pid = fork
|
38
|
+
if pid
|
39
|
+
Process.wait pid
|
40
|
+
else
|
41
|
+
break
|
42
|
+
end
|
43
|
+
else
|
44
|
+
puts "Unknown or ill-formatted command: #{command.inspect}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
exit! if command.nil?
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('../lib/semi-autotest/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.date = SemiAutoTest::VERSION_DATE
|
5
|
+
|
6
|
+
s.name = 'semi-autotest'
|
7
|
+
s.version = SemiAutoTest::VERSION
|
8
|
+
s.homepage = 'https://github.com/Pistos/semi-autotest'
|
9
|
+
|
10
|
+
s.authors = ['Pistos']
|
11
|
+
s.email = ['semiautotest.pistos@purepistos.net']
|
12
|
+
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
|
15
|
+
s.summary = 'Fire off tests without being slowed down by test prep time.'
|
16
|
+
s.description = "Fire off tests without being slowed down by test prep time."
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: semi-autotest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Pistos
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-08-10 00:00:00.000000000 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
description: Fire off tests without being slowed down by test prep time.
|
16
|
+
email:
|
17
|
+
- semiautotest.pistos@purepistos.net
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- LICENCE
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
25
|
+
- lib/semi-autotest.rb
|
26
|
+
- lib/semi-autotest/version.rb
|
27
|
+
- samples/simple/bacon/thing_spec.rb
|
28
|
+
- samples/simple/lib/thing.rb
|
29
|
+
- samples/simple/minitest/thing_test.rb
|
30
|
+
- samples/simple/spec/spec_helper.rb
|
31
|
+
- samples/simple/spec/thing_spec.rb
|
32
|
+
- semi-autotest.gemspec
|
33
|
+
has_rdoc: true
|
34
|
+
homepage: https://github.com/Pistos/semi-autotest
|
35
|
+
licenses: []
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 1.6.2
|
55
|
+
signing_key:
|
56
|
+
specification_version: 3
|
57
|
+
summary: Fire off tests without being slowed down by test prep time.
|
58
|
+
test_files: []
|