teaspoon 1.1.3 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +47 -0
- data/MIT.LICENSE +2 -2
- data/README.md +56 -35
- data/app/assets/javascripts/teaspoon/hook.coffee +1 -1
- data/app/assets/javascripts/teaspoon/teaspoon.coffee +13 -1
- data/app/controllers/teaspoon/suite_controller.rb +18 -13
- data/app/views/teaspoon/suite/_boot.html.erb +1 -1
- data/app/views/teaspoon/suite/index.html.erb +1 -1
- data/lib/generators/teaspoon/install/install_generator.rb +34 -34
- data/lib/generators/teaspoon/install/templates/MISSING_FRAMEWORK +1 -1
- data/lib/generators/teaspoon/install/templates/POST_INSTALL +1 -1
- data/lib/generators/teaspoon/install/templates/env_comments.rb.tt +9 -7
- data/lib/tasks/teaspoon/info.rake +1 -1
- data/lib/teaspoon/command_line.rb +76 -76
- data/lib/teaspoon/configuration.rb +4 -4
- data/lib/teaspoon/console.rb +41 -40
- data/lib/teaspoon/coverage.rb +29 -25
- data/lib/teaspoon/deprecated.rb +1 -1
- data/lib/teaspoon/driver.rb +1 -1
- data/lib/teaspoon/driver/browserstack.rb +111 -0
- data/lib/teaspoon/driver/phantomjs.rb +25 -26
- data/lib/teaspoon/driver/phantomjs/runner.js +31 -3
- data/lib/teaspoon/driver/selenium.rb +13 -9
- data/lib/teaspoon/engine.rb +32 -27
- data/lib/teaspoon/environment.rb +28 -28
- data/lib/teaspoon/exceptions.rb +7 -7
- data/lib/teaspoon/exporter.rb +23 -23
- data/lib/teaspoon/formatter/base.rb +64 -46
- data/lib/teaspoon/formatter/clean.rb +2 -2
- data/lib/teaspoon/formatter/documentation.rb +40 -40
- data/lib/teaspoon/formatter/dot.rb +12 -12
- data/lib/teaspoon/formatter/json.rb +21 -21
- data/lib/teaspoon/formatter/junit.rb +52 -51
- data/lib/teaspoon/formatter/modules/report_module.rb +34 -32
- data/lib/teaspoon/formatter/pride.rb +21 -21
- data/lib/teaspoon/formatter/rspec_html.rb +31 -31
- data/lib/teaspoon/formatter/snowday.rb +6 -5
- data/lib/teaspoon/formatter/swayze_or_oprah.rb +91 -91
- data/lib/teaspoon/formatter/tap.rb +29 -29
- data/lib/teaspoon/formatter/tap_y.rb +57 -57
- data/lib/teaspoon/formatter/teamcity.rb +63 -63
- data/lib/teaspoon/framework/base.rb +1 -1
- data/lib/teaspoon/instrumentation.rb +18 -18
- data/lib/teaspoon/registry.rb +9 -9
- data/lib/teaspoon/registry/has_default.rb +2 -2
- data/lib/teaspoon/runner.rb +37 -37
- data/lib/teaspoon/server.rb +30 -29
- data/lib/teaspoon/suite.rb +68 -57
- data/lib/teaspoon/utility.rb +6 -0
- data/lib/teaspoon/version.rb +1 -1
- metadata +22 -15
- data/lib/teaspoon/driver/capybara_webkit.rb +0 -40
@@ -15,6 +15,8 @@ module Teaspoon
|
|
15
15
|
log_line
|
16
16
|
end
|
17
17
|
|
18
|
+
alias_method :log_exception, :log_error
|
19
|
+
|
18
20
|
def log_result(result)
|
19
21
|
log_information
|
20
22
|
log_stats(result)
|
@@ -31,46 +33,46 @@ module Teaspoon
|
|
31
33
|
|
32
34
|
private
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
def log_information
|
37
|
+
log_pending if pendings.size > 0
|
38
|
+
log_failures if failures.size > 0
|
39
|
+
end
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
def log_pending
|
42
|
+
log_line("Pending:")
|
43
|
+
pendings.each do |result|
|
44
|
+
log_line(" #{result.description}", YELLOW)
|
45
|
+
log_line(" # Not yet implemented\n", CYAN)
|
46
|
+
end
|
44
47
|
end
|
45
|
-
end
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
def log_failures
|
50
|
+
log_line("Failures:\n")
|
51
|
+
failures.each_with_index do |failure, index|
|
52
|
+
log_line(" #{index + 1}) #{failure.description}")
|
53
|
+
log_line(" Failure/Error: #{failure.message}\n", RED)
|
54
|
+
end
|
52
55
|
end
|
53
|
-
end
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
def log_stats(result)
|
58
|
+
log_line("Finished in #{result.elapsed} seconds")
|
59
|
+
stats = "#{pluralize('example', run_count)}, #{pluralize('failure', failures.size)}"
|
60
|
+
stats << ", #{pendings.size} pending" if pendings.size > 0
|
61
|
+
log_line(stats, stats_color)
|
62
|
+
end
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
def log_failed_examples
|
65
|
+
return if failures.size == 0
|
66
|
+
log_line
|
67
|
+
log_line("Failed examples:\n")
|
68
|
+
failures.each do |failure|
|
69
|
+
log_line("teaspoon -s #{@suite_name} --filter=\"#{failure.link}\"", RED)
|
70
|
+
end
|
68
71
|
end
|
69
|
-
end
|
70
72
|
|
71
|
-
|
72
|
-
|
73
|
-
|
73
|
+
def stats_color
|
74
|
+
failures.size > 0 ? RED : pendings.size > 0 ? YELLOW : GREEN
|
75
|
+
end
|
74
76
|
end
|
75
77
|
end
|
76
78
|
end
|
@@ -12,34 +12,34 @@ module Teaspoon
|
|
12
12
|
|
13
13
|
protected
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
def log_spec(result)
|
16
|
+
return log_pride if result.passing?
|
17
|
+
super
|
18
|
+
end
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
def log_pride
|
23
|
+
return log_str(".") unless Teaspoon.configuration.color
|
24
|
+
log_str("\e[38;5;#{next_color}m.\e[0m")
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
def colors
|
28
|
+
@colors ||= (0...42).map do |i|
|
29
|
+
i *= 1.0 / 6
|
30
|
+
36 * calc_color(i) + 6 * calc_color(i + 2 * PI_3) + calc_color(i + 4 * PI_3) + 16
|
31
|
+
end
|
31
32
|
end
|
32
|
-
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
def calc_color(val)
|
35
|
+
(3 * Math.sin(val) + 3).to_i
|
36
|
+
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
def next_color
|
39
|
+
c = colors[@color_index % colors.size]
|
40
|
+
@color_index += 1
|
41
|
+
c
|
42
|
+
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -38,38 +38,38 @@ module Teaspoon
|
|
38
38
|
|
39
39
|
private
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
def log_suite_start(result)
|
42
|
+
@current_suite << result.label
|
43
|
+
log_template @suite_start_template, result
|
44
|
+
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
def log_suite_end
|
47
|
+
log_template @suite_end_template, @current_suite.pop
|
48
|
+
end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
def template(contents)
|
51
|
+
Template.new contents
|
52
|
+
end
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
def log_template(template, object)
|
55
|
+
log_str template.render(object)
|
56
|
+
end
|
57
57
|
|
58
|
-
|
59
|
-
|
58
|
+
class Template
|
59
|
+
include ERB::Util
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
def initialize(contents)
|
62
|
+
@template = contents
|
63
|
+
end
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
def render(obj)
|
66
|
+
@o = obj
|
67
|
+
ERB.new(@template).result binding
|
68
|
+
end
|
68
69
|
end
|
69
|
-
end
|
70
70
|
|
71
|
-
|
72
|
-
|
71
|
+
module Templates
|
72
|
+
CSS = <<-CSS.strip_heredoc
|
73
73
|
body {
|
74
74
|
margin: 0;
|
75
75
|
padding: 0;
|
@@ -191,7 +191,7 @@ module Teaspoon
|
|
191
191
|
}
|
192
192
|
CSS
|
193
193
|
|
194
|
-
|
194
|
+
JAVASCRIPT = <<-JAVASCRIPT.strip_heredoc
|
195
195
|
(function() {
|
196
196
|
"use strict";
|
197
197
|
|
@@ -386,7 +386,7 @@ module Teaspoon
|
|
386
386
|
})();
|
387
387
|
JAVASCRIPT
|
388
388
|
|
389
|
-
|
389
|
+
HEADER = <<-HTML.strip_heredoc
|
390
390
|
<!DOCTYPE html>
|
391
391
|
<html>
|
392
392
|
<head>
|
@@ -422,13 +422,13 @@ module Teaspoon
|
|
422
422
|
<div class="results">
|
423
423
|
HTML
|
424
424
|
|
425
|
-
|
425
|
+
SUITE_START = <<-HTML.strip_heredoc
|
426
426
|
<div class="example_group">
|
427
427
|
<dl>
|
428
428
|
<dt><%= h @o.label %></dt>
|
429
429
|
HTML
|
430
430
|
|
431
|
-
|
431
|
+
SPEC = <<-HTML.strip_heredoc
|
432
432
|
<dd class="example <%= h @o.status %>">
|
433
433
|
<span class="spec-name"><%= h @o.label %></span>
|
434
434
|
<span class="duration"><%= h "\#{@o.elapsed}s" if @o.elapsed %></span>
|
@@ -441,12 +441,12 @@ module Teaspoon
|
|
441
441
|
</dd>
|
442
442
|
HTML
|
443
443
|
|
444
|
-
|
444
|
+
SUITE_END = <<-HTML.strip_heredoc
|
445
445
|
</dl>
|
446
446
|
</div>
|
447
447
|
HTML
|
448
448
|
|
449
|
-
|
449
|
+
FOOTER = <<-HTML.strip_heredoc
|
450
450
|
</div>
|
451
451
|
</div>
|
452
452
|
|
@@ -458,7 +458,7 @@ module Teaspoon
|
|
458
458
|
</body>
|
459
459
|
</html>
|
460
460
|
HTML
|
461
|
-
|
461
|
+
end
|
462
462
|
end
|
463
463
|
end
|
464
464
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
|
2
3
|
require "teaspoon/formatter/dot"
|
3
4
|
|
4
5
|
module Teaspoon
|
@@ -6,11 +7,11 @@ module Teaspoon
|
|
6
7
|
class Snowday < Dot
|
7
8
|
protected
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
def log_spec(result)
|
11
|
+
return log_str("☃", CYAN) if result.passing?
|
12
|
+
return log_str("☹", YELLOW) if result.pending?
|
13
|
+
log_str("☠", RED)
|
14
|
+
end
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
@@ -5,107 +5,107 @@ module Teaspoon
|
|
5
5
|
class SwayzeOrOprah < Base
|
6
6
|
protected
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
def log_result(_result)
|
9
|
+
return log_str("\nNo quote for you.") if failures.size > 0
|
10
|
+
names, quote = random_quote
|
11
|
+
log_line("\n#{quote.inspect} -- Oprah Winfrey or Patrick Swayze?")
|
12
|
+
process_response(names)
|
13
|
+
end
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
17
|
+
DATA = [
|
18
|
+
{
|
19
|
+
author: ["patrick swayze", "patrick", "swayze", "ps", "p"],
|
20
|
+
quotes: <<-QUOTES.strip_heredoc.split("|").strip
|
21
|
+
When those you love die, the best you can do is honor their spirit for as long as you live. You make a \
|
22
|
+
commitment that you're going to take whatever lesson that person or animal was trying to teach you, and \
|
23
|
+
you make it true in your own life... it's a positive way to keep their spirit alive in the world, by \
|
24
|
+
keeping it alive in yourself.|The way to screw up somebody's life is to give them what they want. There's \
|
25
|
+
just something about dance ... It's like a primal thing in all of us.|Pain don't hurt.|What winning is to \
|
26
|
+
me is not giving up, is no matter what's thrown at me, I can take it. And I can keep going.|Good-looking \
|
27
|
+
people turn me off. Myself included.|One thing I'm not going to do is chase staying alive. You spend so \
|
28
|
+
much time chasing staying alive, you won't live.|The way to screw up somebody's life is to give them what \
|
29
|
+
they want.|There's just something about dance. It's like a primal thing in all of us.|As always, I \
|
30
|
+
appreciate all the love and support people have sent and continue to send my way.|Everything is designed \
|
31
|
+
to help you sell out.|How do you nurture a positive attitude when all the statistics say you're a dead \
|
32
|
+
man? You go to work.|I am very, very clear on how difficult it is for a young kid out there to go into the \
|
33
|
+
arts without taking a lot of heat from his peers.|I don't know how many hills and valleys I've had, how \
|
34
|
+
many times I've had to refocus my world and my life and my career. I don't know what's on the other \
|
35
|
+
side.|I don't want to be a poster child for cancer.|I don't want to be Mr. Romantic Leading Man. I don't \
|
36
|
+
want to be the Dance Dude. I don't want to be the Action Guy. If I had to do any one of those all my life, \
|
37
|
+
it'd drive me crazy.|I dropped about 20 pounds in the blink of an eye. And then when you see it in the \
|
38
|
+
mirror, when all of a sudden you pull your eyes down, and the bottom of your eyes go yellow and jaundice \
|
39
|
+
sets in - then you know something's wrong.|I got completely fed up with that Hollywood blockbuster \
|
40
|
+
mentality. I couldn't take it seriously any longer.|I had a lot of anger because I wasn't happy with the \
|
41
|
+
way I had been raised.|I just love to work hard.|I keep dreaming of a future, a future with a long and \
|
42
|
+
healthy life, not lived in the shadow of cancer but in the light.|I keep my heart and my soul and my \
|
43
|
+
spirit open to miracles.|I like to believe that I've got a lot of guardian warriors sittin' on my shoulder \
|
44
|
+
including my dad.|I took after my father.|I wanna live.|I will go so far as to say probably smoking had \
|
45
|
+
something to do with my pancreatic cancer.|I'm trying to shut up and let my angels speak to me and tell me \
|
46
|
+
what I'm supposed to do.|I've had so many injuries.
|
47
|
+
QUOTES
|
48
|
+
},
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
50
|
+
{
|
51
|
+
author: ["oprah winfrey", "oprah", "winfrey", "ow", "o"],
|
52
|
+
quotes: <<-QUOTES.strip_heredoc.split("|").strip
|
53
|
+
Lots of people want to ride with you in the limo, but what you want is someone who will take the bus with \
|
54
|
+
you when the limo breaks down.|Be thankful for what you have; you'll end up having more. If you \
|
55
|
+
concentrate on what you don't have, you will never, ever have enough.|The more you praise and celebrate \
|
56
|
+
your life, the more there is in life to celebrate.|Surround yourself with only people who are going to \
|
57
|
+
lift you higher.|Breathe. Let go. And remind yourself that this very moment is the only one you know you \
|
58
|
+
have for sure.|As you become more clear about who you really are, you'll be better able to decide what is \
|
59
|
+
best for you - the first time around.|It isn't until you come to a spiritual understanding of who you are \
|
60
|
+
- not necessarily a religious feeling, but deep down, the spirit within - that you can begin to take \
|
61
|
+
control.|I am a woman in process. I'm just trying like everybody else. I try to take every conflict, every \
|
62
|
+
experience, and learn from it. Life is never dull.|Turn your wounds into wisdom.|Doing the best at this \
|
63
|
+
moment puts you in the best place for the next moment.|Where there is no struggle, there is no \
|
64
|
+
strength.|Do the one thing you think you cannot do. Fail at it. Try again. Do better the second time. The \
|
65
|
+
only people who never tumble are those who never mount the high wire. This is your moment. Own it.|Passion \
|
66
|
+
is energy. Feel the power that comes from focusing on what excites you.|I don't think of myself as a poor \
|
67
|
+
deprived ghetto girl who made good. I think of myself as somebody who from an early age knew I was \
|
68
|
+
responsible for myself, and I had to make good.|Think like a queen. A queen is not afraid to fail. Failure \
|
69
|
+
is another steppingstone to greatness.|I believe that every single event in life happens in an opportunity \
|
70
|
+
to choose love over fear.|The greatest discovery of all time is that a person can change his future by \
|
71
|
+
merely changing his attitude.|I don't believe in failure. It is not failure if you enjoyed the process.|I \
|
72
|
+
don't think you ever stop giving. I really don't. I think it's an on-going process. And it's not just \
|
73
|
+
about being able to write a check. It's being able to touch somebody's life.|The struggle of my life \
|
74
|
+
created empathy - I could relate to pain, being abandoned, having people not love me.|What material \
|
75
|
+
success does is provide you with the ability to concentrate on other things that really matter. And that \
|
76
|
+
is being able to make a difference, not only in your own life, but in other people's lives.|Books were my \
|
77
|
+
pass to personal freedom. I learned to read at age three, and soon discovered there was a whole world to \
|
78
|
+
conquer that went beyond our farm in Mississippi.|Biology is the least of what makes someone a \
|
79
|
+
mother.|Real integrity is doing the right thing, knowing that nobody's going to know whether you did it or \
|
80
|
+
not.|I have a lot of things to prove to myself. One is that I can live my life fearlessly.
|
81
|
+
QUOTES
|
82
|
+
}
|
83
|
+
]
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
def process_response(names)
|
86
|
+
log_str("Will your run be successful? [swayze or oprah]: ")
|
87
|
+
if names.include?(gets.chomp)
|
88
|
+
log_line("\nYou got it right!\n")
|
89
|
+
else
|
90
|
+
log_line("\nWrong, too bad!\n")
|
91
|
+
raise the roof, YO && "Let's get busy"
|
92
|
+
end
|
92
93
|
end
|
93
|
-
end
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
95
|
+
def random_quote
|
96
|
+
set = DATA[rand(DATA.size)]
|
97
|
+
[set[:author], set[:quotes][rand(set[:quotes].size)]]
|
98
|
+
end
|
99
99
|
|
100
|
-
|
101
|
-
|
102
|
-
|
100
|
+
def the(*_)
|
101
|
+
Exception.new("poorly answered question")
|
102
|
+
end
|
103
103
|
|
104
|
-
|
105
|
-
|
106
|
-
|
104
|
+
def roof
|
105
|
+
0
|
106
|
+
end
|
107
107
|
|
108
|
-
|
108
|
+
YO = 0
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|