ruby_tdd 0.1.6 → 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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ruby_tdd/run.rb +3 -0
- data/lib/ruby_tdd/version.rb +1 -1
- data/lib/test_watch.rb +46 -9
- data/tests/first.test.rb +9 -0
- data/tests/second.test.rb +5 -0
- data/tests/test.rb +1 -10
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36d5fb41863c890e387737e0d977afc44893a50d1917a174ebc604991c689f2f
|
4
|
+
data.tar.gz: 4e301b225ee2c0c917bff2378fa37b5037a16351b5191ac6a6a9bd92397935fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0463e7f464260d9bb884b86d20936717425fe80ce2febfccb610636386bb4e8dfdefd8d0d2a5a86dda080f93f7afca2b3814ca3c6986239528d8758e60a137f0
|
7
|
+
data.tar.gz: 5c31ed157453b4011f68a2b6ed61f2ad80e4f7de32fd3cb5c4b0c31714b7255e53b38dd3ff1f85eab17aabc9ac11e5e26498f70c2d53ddd4e55e7eedbb2aa812
|
data/Gemfile.lock
CHANGED
data/lib/ruby_tdd/run.rb
ADDED
data/lib/ruby_tdd/version.rb
CHANGED
data/lib/test_watch.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
+
require 'rbconfig'
|
1
2
|
require 'listen'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
@relative_path = relative_path
|
6
|
-
@test_block = test_block
|
4
|
+
THIS_FILE = File.expand_path(__FILE__)
|
5
|
+
RUBY = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
|
7
6
|
|
7
|
+
class TestWatch
|
8
|
+
def initialize(listen_to_relative_path, test_relative_path)
|
9
|
+
@listen_to_relative_path = listen_to_relative_path
|
10
|
+
@test_relative_path = test_relative_path
|
8
11
|
start
|
9
12
|
end
|
10
13
|
|
@@ -17,18 +20,52 @@ class TestWatch
|
|
17
20
|
end
|
18
21
|
|
19
22
|
def listener
|
20
|
-
Listen.to(
|
23
|
+
Listen.to(absolute_relative_path) do
|
21
24
|
run
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
25
|
-
def
|
26
|
-
File.expand_path(@
|
28
|
+
def absolute_relative_path
|
29
|
+
File.expand_path(@listen_to_relative_path)
|
30
|
+
end
|
31
|
+
|
32
|
+
def absolute_test_path
|
33
|
+
File.expand_path(@test_relative_path)
|
27
34
|
end
|
28
35
|
|
29
36
|
def run
|
30
37
|
system "clear" or system "cls"
|
31
|
-
puts
|
32
|
-
|
38
|
+
puts test_runner_header + current_time
|
39
|
+
puts
|
40
|
+
put_lines from_test_output
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_paths
|
44
|
+
Dir["#{absolute_test_path}/**/*.test.rb"]
|
45
|
+
end
|
46
|
+
|
47
|
+
def current_time
|
48
|
+
Time.new.inspect
|
49
|
+
end
|
50
|
+
|
51
|
+
def from_test_output
|
52
|
+
test_paths
|
53
|
+
.map { |path| "#{test_header_for path}:\n#{`#{RUBY} #{path}`}\n" }
|
54
|
+
.join ""
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_header_for(path)
|
58
|
+
path.split('/').last.split('.').first.capitalize
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_runner_header
|
62
|
+
"Running tests: "
|
63
|
+
end
|
64
|
+
|
65
|
+
def put_lines(text_with_lines)
|
66
|
+
lines = text_with_lines.split("\n")
|
67
|
+
lines.each do |line|
|
68
|
+
puts "#{line}"
|
69
|
+
end
|
33
70
|
end
|
34
71
|
end
|
data/tests/first.test.rb
ADDED
data/tests/test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_tdd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- August Alexandersson
|
@@ -54,10 +54,13 @@ files:
|
|
54
54
|
- bin/console
|
55
55
|
- bin/setup
|
56
56
|
- lib/ruby_tdd.rb
|
57
|
+
- lib/ruby_tdd/run.rb
|
57
58
|
- lib/ruby_tdd/version.rb
|
58
59
|
- lib/stub.rb
|
59
60
|
- lib/test_watch.rb
|
60
61
|
- ruby_tdd.gemspec
|
62
|
+
- tests/first.test.rb
|
63
|
+
- tests/second.test.rb
|
61
64
|
- tests/test.rb
|
62
65
|
homepage: https://github.com/Augustalex/ruby_tdd
|
63
66
|
licenses:
|