guard-konacha 0.2.0 → 0.2.1
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/Readme.md +2 -1
- data/lib/guard/konacha/runner.rb +20 -6
- data/lib/guard/konacha/templates/Guardfile +2 -1
- data/lib/guard/konacha/version.rb +1 -1
- metadata +4 -4
data/Readme.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Guard::Konacha
|
1
|
+
# Guard::Konacha [](https://travis-ci.org/alexgb/guard-konacha)
|
2
2
|
|
3
3
|
Automatically run your [Konacha](https://github.com/jfirebaugh/konacha) tests through [Guard](https://github.com/guard/guard/).
|
4
4
|
|
@@ -17,6 +17,7 @@ Or add to your Gemfile:
|
|
17
17
|
Add guard definitions to your `Guardfile`
|
18
18
|
|
19
19
|
guard :konacha do
|
20
|
+
watch(%r{^app/assets/javascripts/(.*)\.js(\.coffee)?$}) { |m| "#{m[1]}_spec.js" }
|
20
21
|
watch(%r{^spec/javascripts/.+_spec(\.js|\.js\.coffee)$})
|
21
22
|
end
|
22
23
|
|
data/lib/guard/konacha/runner.rb
CHANGED
@@ -55,8 +55,8 @@ module Guard
|
|
55
55
|
:duration => 0
|
56
56
|
}
|
57
57
|
|
58
|
-
urls.
|
59
|
-
individual_result = run_tests(url)
|
58
|
+
urls.each_with_index do |url, index|
|
59
|
+
individual_result = run_tests(url, paths[index])
|
60
60
|
|
61
61
|
test_results[:examples] += individual_result[:examples]
|
62
62
|
test_results[:failures] += individual_result[:failures]
|
@@ -64,7 +64,6 @@ module Guard
|
|
64
64
|
test_results[:duration] += individual_result[:duration]
|
65
65
|
end
|
66
66
|
|
67
|
-
|
68
67
|
result_line = "#{test_results[:examples]} examples, #{test_results[:failures]} failures"
|
69
68
|
result_line << ", #{test_results[:pending]} pending" if test_results[:pending] > 0
|
70
69
|
text = [
|
@@ -80,7 +79,21 @@ module Guard
|
|
80
79
|
end
|
81
80
|
end
|
82
81
|
|
83
|
-
|
82
|
+
EMPTY_RESULT = {
|
83
|
+
:examples => 0,
|
84
|
+
:failures => 0,
|
85
|
+
:pending => 0,
|
86
|
+
:duration => 0,
|
87
|
+
}
|
88
|
+
|
89
|
+
def run_tests(url, path)
|
90
|
+
session.visit url
|
91
|
+
|
92
|
+
if session.status_code == 404
|
93
|
+
UI.warning "No spec found for: #{path}"
|
94
|
+
return EMPTY_RESULT
|
95
|
+
end
|
96
|
+
|
84
97
|
runner = ::Konacha::Runner.new session
|
85
98
|
runner.run url
|
86
99
|
return {
|
@@ -89,6 +102,9 @@ module Guard
|
|
89
102
|
:pending => runner.reporter.pending_count,
|
90
103
|
:duration => runner.reporter.duration
|
91
104
|
}
|
105
|
+
rescue => e
|
106
|
+
UI.error e.inspect
|
107
|
+
@session = nil
|
92
108
|
end
|
93
109
|
|
94
110
|
def run_all
|
@@ -106,8 +122,6 @@ module Guard
|
|
106
122
|
def session
|
107
123
|
UI.info "Starting Konacha-Capybara session using #{@options[:driver]} driver, this can take a few seconds..." if @session.nil?
|
108
124
|
@session ||= Capybara::Session.new @options[:driver]
|
109
|
-
# @session.reset!
|
110
|
-
# @session
|
111
125
|
end
|
112
126
|
|
113
127
|
def spawn_konacha_command
|
@@ -1,6 +1,7 @@
|
|
1
1
|
### Guard::Konacha
|
2
2
|
# available options:
|
3
|
-
# - :spec_dir
|
3
|
+
# - :spec_dir, defaults to 'spec/javascripts'
|
4
|
+
# - :driver, defaults to :selenium
|
4
5
|
guard :konacha do
|
5
6
|
watch(%r{^app/assets/javascripts/(.*)\.js(\.coffee)?$}) { |m| "#{m[1]}_spec.js" }
|
6
7
|
watch(%r{^spec/javascripts/.+_spec(\.js|\.js\.coffee)$})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-konacha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
@@ -137,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
137
137
|
version: '0'
|
138
138
|
segments:
|
139
139
|
- 0
|
140
|
-
hash:
|
140
|
+
hash: 735851984399923246
|
141
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
142
|
none: false
|
143
143
|
requirements:
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
version: '0'
|
147
147
|
segments:
|
148
148
|
- 0
|
149
|
-
hash:
|
149
|
+
hash: 735851984399923246
|
150
150
|
requirements: []
|
151
151
|
rubyforge_project:
|
152
152
|
rubygems_version: 1.8.24
|