teaspoon 1.1.5 → 1.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.
Files changed (53) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +5 -0
  3. data/MIT.LICENSE +2 -2
  4. data/README.md +37 -28
  5. data/app/assets/javascripts/teaspoon/hook.coffee +1 -1
  6. data/app/assets/javascripts/teaspoon/teaspoon.coffee +13 -1
  7. data/app/controllers/teaspoon/suite_controller.rb +18 -13
  8. data/app/views/teaspoon/suite/index.html.erb +1 -1
  9. data/lib/generators/teaspoon/install/install_generator.rb +34 -34
  10. data/lib/generators/teaspoon/install/templates/MISSING_FRAMEWORK +1 -1
  11. data/lib/generators/teaspoon/install/templates/POST_INSTALL +1 -1
  12. data/lib/generators/teaspoon/install/templates/_boot.html.erb +1 -1
  13. data/lib/generators/teaspoon/install/templates/env_comments.rb.tt +8 -8
  14. data/lib/tasks/teaspoon/info.rake +1 -1
  15. data/lib/teaspoon/command_line.rb +76 -76
  16. data/lib/teaspoon/configuration.rb +4 -4
  17. data/lib/teaspoon/console.rb +40 -40
  18. data/lib/teaspoon/coverage.rb +29 -25
  19. data/lib/teaspoon/deprecated.rb +1 -1
  20. data/lib/teaspoon/driver.rb +0 -1
  21. data/lib/teaspoon/driver/browserstack.rb +48 -51
  22. data/lib/teaspoon/driver/phantomjs.rb +25 -25
  23. data/lib/teaspoon/driver/phantomjs/runner.js +31 -3
  24. data/lib/teaspoon/driver/selenium.rb +13 -9
  25. data/lib/teaspoon/engine.rb +26 -15
  26. data/lib/teaspoon/environment.rb +28 -28
  27. data/lib/teaspoon/exceptions.rb +7 -7
  28. data/lib/teaspoon/exporter.rb +23 -23
  29. data/lib/teaspoon/formatter/base.rb +64 -46
  30. data/lib/teaspoon/formatter/clean.rb +2 -2
  31. data/lib/teaspoon/formatter/documentation.rb +40 -40
  32. data/lib/teaspoon/formatter/dot.rb +12 -12
  33. data/lib/teaspoon/formatter/json.rb +21 -21
  34. data/lib/teaspoon/formatter/junit.rb +52 -52
  35. data/lib/teaspoon/formatter/modules/report_module.rb +34 -32
  36. data/lib/teaspoon/formatter/pride.rb +21 -21
  37. data/lib/teaspoon/formatter/rspec_html.rb +31 -31
  38. data/lib/teaspoon/formatter/snowday.rb +6 -5
  39. data/lib/teaspoon/formatter/swayze_or_oprah.rb +91 -91
  40. data/lib/teaspoon/formatter/tap.rb +29 -29
  41. data/lib/teaspoon/formatter/tap_y.rb +57 -57
  42. data/lib/teaspoon/formatter/teamcity.rb +63 -63
  43. data/lib/teaspoon/framework/base.rb +1 -1
  44. data/lib/teaspoon/instrumentation.rb +18 -18
  45. data/lib/teaspoon/registry.rb +8 -8
  46. data/lib/teaspoon/registry/has_default.rb +2 -2
  47. data/lib/teaspoon/runner.rb +37 -37
  48. data/lib/teaspoon/server.rb +30 -29
  49. data/lib/teaspoon/suite.rb +68 -57
  50. data/lib/teaspoon/utility.rb +6 -0
  51. data/lib/teaspoon/version.rb +1 -1
  52. metadata +10 -18
  53. data/lib/teaspoon/driver/capybara_webkit.rb +0 -40
@@ -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
- def log_spec(result)
10
- return log_str("☃", CYAN) if result.passing?
11
- return log_str("☹", YELLOW) if result.pending?
12
- log_str("☠", RED)
13
- end
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
- 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
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
- 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
- },
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
- 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
- ]
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
- 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"
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
- def random_quote
96
- set = DATA[rand(DATA.size)]
97
- [set[:author], set[:quotes][rand(set[:quotes].size)]]
98
- end
95
+ def random_quote
96
+ set = DATA[rand(DATA.size)]
97
+ [set[:author], set[:quotes][rand(set[:quotes].size)]]
98
+ end
99
99
 
100
- def the(*_)
101
- Exception.new("poorly answered question")
102
- end
100
+ def the(*_)
101
+ Exception.new("poorly answered question")
102
+ end
103
103
 
104
- def roof
105
- 0
106
- end
104
+ def roof
105
+ 0
106
+ end
107
107
 
108
- YO = 0
108
+ YO = 0
109
109
  end
110
110
  end
111
111
  end
@@ -5,35 +5,35 @@ module Teaspoon
5
5
  class Tap < Base
6
6
  protected
7
7
 
8
- def log_runner(_result)
9
- log_line("1..#{@total_count}")
10
- end
11
-
12
- def log_passing_spec(result)
13
- log_line("ok #{@run_count} - #{result.description}")
14
- end
15
-
16
- def log_pending_spec(result)
17
- log_line("ok #{@run_count} - [pending] #{result.description}")
18
- end
19
-
20
- def log_failing_spec(result)
21
- log_line("not ok #{@run_count} - #{result.description}")
22
- log_line(" FAIL #{result.message}")
23
- end
24
-
25
- def log_console(message)
26
- log_line("# #{message.gsub(/\n$/, '')}")
27
- end
28
-
29
- def log_coverage(message)
30
- log_line("# #{message.gsub(/\n/, "\n# ")}")
31
- end
32
-
33
- def log_threshold_failure(message)
34
- log_line("not ok #{@run_count + 1} - Coverage threshold failed")
35
- log_line("# #{message.gsub(/\n/, "\n# ")}")
36
- end
8
+ def log_runner(_result)
9
+ log_line("1..#{@total_count}")
10
+ end
11
+
12
+ def log_passing_spec(result)
13
+ log_line("ok #{@run_count} - #{result.description}")
14
+ end
15
+
16
+ def log_pending_spec(result)
17
+ log_line("ok #{@run_count} - [pending] #{result.description}")
18
+ end
19
+
20
+ def log_failing_spec(result)
21
+ log_line("not ok #{@run_count} - #{result.description}")
22
+ log_line(" FAIL #{result.message}")
23
+ end
24
+
25
+ def log_console(message)
26
+ log_line("# #{message.gsub(/\n$/, '')}")
27
+ end
28
+
29
+ def log_coverage(message)
30
+ log_line("# #{message.gsub(/\n/, "\n# ")}")
31
+ end
32
+
33
+ def log_threshold_failure(message)
34
+ log_line("not ok #{@run_count + 1} - Coverage threshold failed")
35
+ log_line("# #{message.gsub(/\n/, "\n# ")}")
36
+ end
37
37
  end
38
38
  end
39
39
  end
@@ -6,71 +6,71 @@ module Teaspoon
6
6
  class TapY < Base
7
7
  protected
8
8
 
9
- def log_runner(result)
10
- log "type" => "suite",
11
- "start" => result.start,
12
- "count" => result.total,
13
- "seed" => 0,
14
- "rev" => 4
15
- end
9
+ def log_runner(result)
10
+ log "type" => "suite",
11
+ "start" => result.start,
12
+ "count" => result.total,
13
+ "seed" => 0,
14
+ "rev" => 4
15
+ end
16
16
 
17
- def log_suite(result)
18
- log "type" => "case",
19
- "label" => result.label,
20
- "level" => result.level
21
- end
17
+ def log_suite(result)
18
+ log "type" => "case",
19
+ "label" => result.label,
20
+ "level" => result.level
21
+ end
22
22
 
23
- def log_passing_spec(result)
24
- log "type" => "test",
25
- "status" => "pass",
26
- "label" => result.label,
27
- "stdout" => @stdout
28
- end
23
+ def log_passing_spec(result)
24
+ log "type" => "test",
25
+ "status" => "pass",
26
+ "label" => result.label,
27
+ "stdout" => @stdout
28
+ end
29
29
 
30
- def log_pending_spec(result)
31
- log "type" => "test",
32
- "status" => "pending",
33
- "label" => result.label,
34
- "stdout" => @stdout,
35
- "exception" => {
36
- "message" => result.message
37
- }
38
- end
30
+ def log_pending_spec(result)
31
+ log "type" => "test",
32
+ "status" => "pending",
33
+ "label" => result.label,
34
+ "stdout" => @stdout,
35
+ "exception" => {
36
+ "message" => result.message
37
+ }
38
+ end
39
39
 
40
- def log_failing_spec(result)
41
- log "type" => "test",
42
- "status" => "fail",
43
- "label" => result.label,
44
- "stdout" => @stdout,
45
- "exception" => {
46
- "message" => result.message,
47
- "backtrace" => ["#{result.link}#:0"],
48
- "file" => "unknown",
49
- "line" => "unknown",
50
- "source" => "unknown",
51
- "snippet" => { "0" => result.link },
52
- "class" => "Unknown"
53
- }
54
- end
40
+ def log_failing_spec(result)
41
+ log "type" => "test",
42
+ "status" => "fail",
43
+ "label" => result.label,
44
+ "stdout" => @stdout,
45
+ "exception" => {
46
+ "message" => result.message,
47
+ "backtrace" => ["#{result.link}#:0"],
48
+ "file" => "unknown",
49
+ "line" => "unknown",
50
+ "source" => "unknown",
51
+ "snippet" => { "0" => result.link },
52
+ "class" => "Unknown"
53
+ }
54
+ end
55
55
 
56
- def log_result(result)
57
- log "type" => "final",
58
- "time" => result.elapsed,
59
- "counts" => {
60
- "total" => @run_count,
61
- "pass" => @passes.size,
62
- "fail" => @failures.size,
63
- "error" => @errors.size,
64
- "omit" => 0,
65
- "todo" => @pendings.size
66
- }
67
- end
56
+ def log_result(result)
57
+ log "type" => "final",
58
+ "time" => result.elapsed,
59
+ "counts" => {
60
+ "total" => @run_count,
61
+ "pass" => @passes.size,
62
+ "fail" => @failures.size,
63
+ "error" => @errors.size,
64
+ "omit" => 0,
65
+ "todo" => @pendings.size
66
+ }
67
+ end
68
68
 
69
69
  private
70
70
 
71
- def log(hash)
72
- log_str(hash.to_yaml)
73
- end
71
+ def log(hash)
72
+ log_str(hash.to_yaml)
73
+ end
74
74
  end
75
75
  end
76
76
  end
@@ -10,87 +10,87 @@ module Teaspoon
10
10
 
11
11
  protected
12
12
 
13
- def log_runner(result)
14
- log("testCount count='#{result.total}' timestamp='#{result.start}'")
15
- end
16
-
17
- def log_suite(result)
18
- log_end_suite
19
- log("testSuiteStarted name='#{result.label}'")
20
- end
13
+ def log_runner(result)
14
+ log("testCount count='#{result.total}' timestamp='#{result.start}'")
15
+ end
21
16
 
22
- def log_passing_spec(result)
23
- log_teamcity_spec(type: "testStarted", desc: escape(result.description))
24
- end
17
+ def log_suite(result)
18
+ log_end_suite
19
+ log("testSuiteStarted name='#{result.label}'")
20
+ end
25
21
 
26
- def log_pending_spec(result)
27
- log_teamcity_spec(type: "testIgnored", desc: escape(result.description))
28
- end
22
+ def log_passing_spec(result)
23
+ log_teamcity_spec(type: "testStarted", desc: escape(result.description))
24
+ end
29
25
 
30
- def log_failing_spec(result)
31
- log_teamcity_spec(type: "testStarted", desc: escape(result.description)) do
32
- log("testFailed name='#{escape(result.description)}' message='#{escape(result.message)}'")
26
+ def log_pending_spec(result)
27
+ log_teamcity_spec(type: "testIgnored", desc: escape(result.description))
33
28
  end
34
- end
35
29
 
36
- def log_error(result)
37
- log("message text='#{escape(result.message)}' errorDetails='#{escape_trace(result.trace)}' status='ERROR'")
38
- end
30
+ def log_failing_spec(result)
31
+ log_teamcity_spec(type: "testStarted", desc: escape(result.description)) do
32
+ log("testFailed name='#{escape(result.description)}' message='#{escape(result.message)}'")
33
+ end
34
+ end
39
35
 
40
- def log_result(result)
41
- log_end_suite
42
- @result = result
43
- end
36
+ def log_error(result)
37
+ log("message text='#{escape(result.message)}' errorDetails='#{escape_trace(result.trace)}' status='ERROR'")
38
+ end
44
39
 
45
- def log_coverage(message)
46
- log("testSuiteStarted name='Coverage summary'")
47
- log_line(message)
48
- log("testSuiteFinished name='Coverage summary'")
49
- end
40
+ def log_result(result)
41
+ log_end_suite
42
+ @result = result
43
+ end
50
44
 
51
- def log_threshold_failure(message)
52
- log("testSuiteStarted name='Coverage thresholds'")
53
- log_teamcity_spec(type: "testStarted", desc: "Coverage thresholds") do
54
- log("testFailed name='Coverage thresholds' message='were not met'")
45
+ def log_coverage(message)
46
+ log("testSuiteStarted name='Coverage summary'")
55
47
  log_line(message)
48
+ log("testSuiteFinished name='Coverage summary'")
56
49
  end
57
- log("testSuiteFinished name='Coverage thresholds'")
58
- end
59
50
 
60
- def log_complete(failure_count)
61
- log_line("\nFinished in #{@result.elapsed} seconds")
62
- stats = "#{pluralize('example', run_count)}, #{pluralize('failure', failure_count)}"
63
- stats << ", #{pendings.size} pending" if pendings.size > 0
64
- log_line(stats)
65
- log_line if failure_count > 0
66
- end
51
+ def log_threshold_failure(message)
52
+ log("testSuiteStarted name='Coverage thresholds'")
53
+ log_teamcity_spec(type: "testStarted", desc: "Coverage thresholds") do
54
+ log("testFailed name='Coverage thresholds' message='were not met'")
55
+ log_line(message)
56
+ end
57
+ log("testSuiteFinished name='Coverage thresholds'")
58
+ end
59
+
60
+ def log_complete(failure_count)
61
+ log_line("\nFinished in #{@result.elapsed} seconds")
62
+ stats = "#{pluralize('example', run_count)}, #{pluralize('failure', failure_count)}"
63
+ stats << ", #{pendings.size} pending" if pendings.size > 0
64
+ log_line(stats)
65
+ log_line if failure_count > 0
66
+ end
67
67
 
68
68
  private
69
69
 
70
- def log_end_suite
71
- log("testSuiteFinished name='#{escape(@last_suite.label)}'") if @last_suite
72
- end
70
+ def log_end_suite
71
+ log("testSuiteFinished name='#{escape(@last_suite.label)}'") if @last_suite
72
+ end
73
73
 
74
- def log_teamcity_spec(opts, &_block)
75
- log("#{opts[:type]} name='#{opts[:desc]}' captureStandardOutput='true'")
76
- log_line(@stdout.gsub(/\n$/, "")) unless @stdout.blank?
77
- yield if block_given?
78
- log("testFinished name='#{opts[:desc]}'")
79
- end
74
+ def log_teamcity_spec(opts, &_block)
75
+ log("#{opts[:type]} name='#{opts[:desc]}' captureStandardOutput='true'")
76
+ log_line(@stdout.gsub(/\n$/, "")) unless @stdout.blank?
77
+ yield if block_given?
78
+ log("testFinished name='#{opts[:desc]}'")
79
+ end
80
80
 
81
- def log(str)
82
- log_line("##teamcity[#{str}]")
83
- end
81
+ def log(str)
82
+ log_line("##teamcity[#{str}]")
83
+ end
84
84
 
85
- def escape(str)
86
- str = str.gsub(/[|'\[\]]/) { |c| "|#{c}" }
87
- str.gsub("\n", "|n").gsub("\r", "|r")
88
- end
85
+ def escape(str)
86
+ str = str.gsub(/[|'\[\]]/) { |c| "|#{c}" }
87
+ str.gsub("\n", "|n").gsub("\r", "|r")
88
+ end
89
89
 
90
- def escape_trace(trace)
91
- lines = trace.map { |t| ["#{t['file']}:#{t['line']}", t["function"]].compact.join(" ") }
92
- escape(lines.join("\n"))
93
- end
90
+ def escape_trace(trace)
91
+ lines = trace.map { |t| ["#{t['file']}:#{t['line']}", t["function"]].compact.join(" ") }
92
+ escape(lines.join("\n"))
93
+ end
94
94
  end
95
95
  end
96
96
  end