slacker 1.0.10 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2VhYWRjODA5Yjc1MjhlMjkyYWViZGM0YzVhM2ZjODE4MDU3MDRiZA==
4
+ ZmQ1YzM5YjRiZTEwMWQ3YjZhZjRkNjRiMmNiZTZmNTJjMzZjZTMxZQ==
5
5
  data.tar.gz: !binary |-
6
- ZWE5ZjUyYzRiNmQ5OTY0MDdlNWQ4Yzc3NDE4YmUwNjA2MmE0YTE3OA==
6
+ OTY5NWUzNjlkOGZkZTJlMzM2YWFlOGJhYWZlMWY5ZmJmZDZjZjViMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDQyY2I0M2FiZjM2MDc5ODhlNTg1YjI3ZTE2ZDVlY2ZkNDE1YzI2ZGIzOTcz
10
- NDY0Yzk0NWQwOWVlZDk5NDJjYzJjOTY1NjlmZTQ0ZTg4N2E4ZDc4YzVjM2Iy
11
- ODlmOGZmYmY4YjNmNTU0YzhlMWQxNmY0YzUwMjZmYzRiMTVmMDQ=
9
+ Yzc3ZmNiNDZhNzYwZTZlZjQ4ODE2Zjg0NTFhMjI1NGVmM2FiYjViZTgwOTY4
10
+ Yzc3YjI1NjFjYzJkODk3ZjEyY2JlYWZjMDVjOWNhYzY3OGRjODYxODQ2Y2Rj
11
+ MDI0OTNhOGVmYTAwYjFkOGMzMjA3YzUxYjI2ODJhODU0ZDBiYjQ=
12
12
  data.tar.gz: !binary |-
13
- ZDA5MmEyYjRmMTE0Njc1YjMxMTA3NWQ1YTdjN2Q1MWY1NTMxOWZkZDhmNWY3
14
- YmYyZjU5NjcxMzczYzU0ZGUyMjg3OGM2NTA5MDgwNzgwZDZkZWJlMjBjYmRj
15
- NjBhZTJlZGM4MGQ1YWJmMzNmYzI1MTU0N2E3ZTZlMGQwOTg1NjE=
13
+ MDIyNTg0OWE5NDY1YzhhNWIzYmY5MGNhY2U4NjE1YmZjMGRjMDYyZDNhMWI2
14
+ Nzg0N2NmNmM1YTMwMjEwNzYxOTkzYWZhZTM3YjU5MTZmOWFiY2FhNWE4ZWM1
15
+ YjMzY2MzNzQzOGYwMGIxMDJjZTBiYzM4YjA5NjIyNDczYTYzYmQ=
@@ -2,7 +2,7 @@
2
2
  require 'bundler/setup'
3
3
  require 'slacker'
4
4
  require 'yaml'
5
- require 'slacker/command_line_formatter2'
5
+ require 'slacker/command_line_formatter'
6
6
 
7
7
  def db_config_from_file(file_path)
8
8
  dbconfig = nil
@@ -191,7 +191,7 @@ EOF
191
191
  config.output_stream = @configuration.output_stream
192
192
  config.error_stream = @configuration.error_stream
193
193
 
194
- config.add_formatter(Slacker::CommandLineFormatter2)
194
+ config.add_formatter(Slacker::CommandLineFormatter)
195
195
  end
196
196
  end
197
197
 
@@ -4,6 +4,7 @@ require 'rspec/core/formatters/progress_formatter'
4
4
  module Slacker
5
5
  class CommandLineFormatter < RSpec::Core::Formatters::ProgressFormatter
6
6
  include Slacker::Formatter
7
+ RSpec::Core::Formatters.register self, :example_passed, :example_failed
7
8
 
8
9
  def initialize(output)
9
10
  super(output)
@@ -11,46 +12,47 @@ module Slacker
11
12
  @passed_examples_count = 0
12
13
  end
13
14
 
14
- def example_passed(example)
15
- process_example_debug_output(example, false)
16
- super(example)
15
+ def example_passed(notification)
16
+ super(notification)
17
+ process_example_debug_output(notification, false)
17
18
  end
18
19
 
19
- def example_failed(example)
20
- process_example_debug_output(example, true)
21
- super(example)
20
+ def example_failed(notification)
21
+ super(notification)
22
+ process_example_debug_output(notification, true)
22
23
  end
23
24
 
24
25
  private
25
26
 
26
- def process_example_debug_output(example, example_failed)
27
+ def process_example_debug_output(notification, example_failed)
27
28
  if example_failed
28
29
  @failed_examples_count += 1
29
- debug_output(example, Slacker.configuration.expand_path('debug/failed_examples'), @failed_examples_count, example_failed)
30
+ debug_output(notification, Slacker.configuration.expand_path('debug/failed_examples'), @failed_examples_count, example_failed)
30
31
  else
31
32
  @passed_examples_count += 1
32
- debug_output(example, Slacker.configuration.expand_path('debug/passed_examples'), @passed_examples_count, example_failed)
33
+ debug_output(notification, Slacker.configuration.expand_path('debug/passed_examples'), @passed_examples_count, example_failed)
33
34
  end
34
35
  end
35
36
 
36
- def debug_output(example, out_folder, file_number, example_failed)
37
+ def debug_output(notification, out_folder, file_number, example_failed)
37
38
  # Write out the SQL
38
39
  File.open("#{out_folder}/example_#{'%03d' % file_number}.sql", 'w') do |out_file|
39
- out_file.write(get_formatted_example_sql(example, example_failed))
40
+ out_file.write(get_formatted_example_sql(notification, example_failed))
40
41
  end
41
42
  end
42
43
 
43
- def get_formatted_example_sql(example, example_failed)
44
+ def get_formatted_example_sql(notification, example_failed)
45
+ example = notification.example
44
46
  sql = <<EOF
45
47
  -- Example "#{example.metadata[:full_description]}"
46
48
  -- #{example.metadata[:location]}
47
- -- Executed at #{example.metadata[:execution_result][:started_at]}
49
+ -- Executed at #{example.execution_result.started_at}
48
50
 
49
51
  #{example.metadata[:sql]}
50
52
 
51
53
  -- SLACKER RESULTS
52
54
  -- *******************************************
53
- #{example_failed ? example_failure_text(example).split("\n").collect{|line| '-- ' + line}.join("\n") : '-- Example Passed OK'}
55
+ #{example_failed ? example_failure_text(notification).split("\n").collect{|line| '-- ' + line}.join("\n") : '-- Example Passed OK'}
54
56
  -- *******************************************
55
57
  EOF
56
58
  sql.strip
@@ -1,3 +1,3 @@
1
1
  module Slacker
2
- VERSION = "1.0.10"
2
+ VERSION = "1.0.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vassil Kovatchev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-03 00:00:00.000000000 Z
11
+ date: 2015-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,7 +75,6 @@ files:
75
75
  - lib/slacker.rb
76
76
  - lib/slacker/application.rb
77
77
  - lib/slacker/command_line_formatter.rb
78
- - lib/slacker/command_line_formatter2.rb
79
78
  - lib/slacker/configuration.rb
80
79
  - lib/slacker/formatter.rb
81
80
  - lib/slacker/query_result_matcher.rb
@@ -1,61 +0,0 @@
1
- require 'slacker/formatter'
2
- require 'rspec/core/formatters/progress_formatter'
3
-
4
- module Slacker
5
- class CommandLineFormatter2 < RSpec::Core::Formatters::ProgressFormatter
6
- include Slacker::Formatter
7
- RSpec::Core::Formatters.register self, :example_passed, :example_failed
8
-
9
- def initialize(output)
10
- super(output)
11
- @failed_examples_count = 0
12
- @passed_examples_count = 0
13
- end
14
-
15
- def example_passed(notification)
16
- super(notification)
17
- process_example_debug_output(notification, false)
18
- end
19
-
20
- def example_failed(notification)
21
- super(notification)
22
- process_example_debug_output(notification, true)
23
- end
24
-
25
- private
26
-
27
- def process_example_debug_output(notification, example_failed)
28
- if example_failed
29
- @failed_examples_count += 1
30
- debug_output(notification, Slacker.configuration.expand_path('debug/failed_examples'), @failed_examples_count, example_failed)
31
- else
32
- @passed_examples_count += 1
33
- debug_output(notification, Slacker.configuration.expand_path('debug/passed_examples'), @passed_examples_count, example_failed)
34
- end
35
- end
36
-
37
- def debug_output(notification, out_folder, file_number, example_failed)
38
- # Write out the SQL
39
- File.open("#{out_folder}/example_#{'%03d' % file_number}.sql", 'w') do |out_file|
40
- out_file.write(get_formatted_example_sql(notification, example_failed))
41
- end
42
- end
43
-
44
- def get_formatted_example_sql(notification, example_failed)
45
- example = notification.example
46
- sql = <<EOF
47
- -- Example "#{example.metadata[:full_description]}"
48
- -- #{example.metadata[:location]}
49
- -- Executed at #{example.execution_result.started_at}
50
-
51
- #{example.metadata[:sql]}
52
-
53
- -- SLACKER RESULTS
54
- -- *******************************************
55
- #{example_failed ? example_failure_text(notification).split("\n").collect{|line| '-- ' + line}.join("\n") : '-- Example Passed OK'}
56
- -- *******************************************
57
- EOF
58
- sql.strip
59
- end
60
- end
61
- end