gorgon 0.9.0 → 0.10.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTA0MWUwMjQ4ZmIzZmM0ZjAyYWJjOWYxMTA1NWQwZGFiZTQ0MzQ5Yg==
4
+ OGZiMzQ4NmM4NWFmMTQ3Y2U3MzU4NDQxYjc3NDgzM2RmMTM1OWUyYQ==
5
5
  data.tar.gz: !binary |-
6
- MTA4NGNjZjU2OWQxOWQxMmZkYTlkOGNjYjI0MmIxYTI5ODMzZGEzYQ==
6
+ ZGNlMDc1OWM5ZmFkMjdjZmUxYmJmMDM0NmNlYWFkNDA1NDBiYzRhNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- N2U2ZWZlMWNkNDI2YTEyOTkwNGYwZjQwNGI0NWJmMGEzOGI0ZDg2YTA0MWYw
10
- MDgxNGQzMTcwOTZmYmY3OTk4MzY3YTk3NDBmNjEyYjhlMjQwMGEwNDQ0Y2Jk
11
- MGJhYTk3M2EyZWE2ZjU5MzZiNTAyNWNhOTdkZTYzYWU0YzViYzk=
9
+ MDRjZGQ3ZmU5YmVjMTAwZDcyNDM4ZDMwYjcyYWQ4N2JhMzA4MTA3N2ZkY2U4
10
+ ZTRlNjgxZWUzOGQ0MDg3NDQ0YTEwNDQwZWVjOWExYjU1MWIyYmRkN2RkMzg3
11
+ MTE1OWNmMWI1NDAxMTNmM2ZiZWVlZjQyNWZjNzIzMzA2YzUxZDc=
12
12
  data.tar.gz: !binary |-
13
- Mzg3NDc4MWZjNzE0MDYwMjZmNWMzMjE1MzNhY2JkYTU2MzBhZTQ0ZmYzNTdm
14
- MjdkYTM3YTY5MWVlMjE2ZjRiZjMyYjdmMDNjZDZmMTQ4ODM5Njk3NGU0ZjIy
15
- MmYyMDYxOTJkNGFiMzVjZjgxZWRlMDk3NzZhMzQ3M2E5NzEwNjk=
13
+ MGI1OGEzZjA5YmFlZDFlOWIxNWEwMDAxYTI5NDQ3ZDcyYzVkODU4Zjk4NjYy
14
+ MGM1N2I2N2E3OTRkNGYxMDI3YWUwNWExYmVlZWRmYzBiOTMwNGM5MjMxMzU1
15
+ ZmZiN2EyMGFjMDlmZDkyYTlmNzVhNTM1OTdmNTBlODEyMzZjMmM=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gorgon (0.9.0)
4
+ gorgon (0.10.0)
5
5
  amqp (~> 1.1.0)
6
6
  awesome_print
7
7
  colorize (~> 0.5.8)
@@ -5,6 +5,10 @@ module RSpec
5
5
  module Core
6
6
  module Formatters
7
7
  class GorgonRspecFormatter < BaseFormatter
8
+ if Formatters.respond_to? :register
9
+ Formatters.register self, :message, :stop, :close
10
+ end
11
+
8
12
  attr_reader :output
9
13
 
10
14
  def initialize(output)
@@ -16,30 +20,35 @@ module RSpec
16
20
  @failures += message unless @failures.empty?
17
21
  end
18
22
 
19
- def stop
20
- super
21
- failures = examples.select { |e| e.execution_result[:status] == "failed" }
22
-
23
- @failures += failures.map do |failure|
23
+ def stop(notification=nil)
24
+ @failures += failures(notification).map do |failure|
24
25
  {
25
- :test_name => "#{failure.full_description}: " \
26
- "line #{failure.metadata[:line_number]}",
27
- :description => failure.description,
28
- :full_description => failure.full_description,
29
- :status => failure.execution_result[:status],
30
- :file_path => failure.metadata[:file_path],
31
- :line_number => failure.metadata[:line_number],
26
+ test_name: "#{failure.full_description}: line #{failure.metadata[:line_number]}",
27
+ description: failure.description,
28
+ full_description: failure.full_description,
29
+ status: :failed,
30
+ file_path: failure.metadata[:file_path],
31
+ line_number: failure.metadata[:line_number],
32
32
  }.tap do |hash|
33
- if e=failure.exception
34
- hash[:class] = e.class.name
35
- hash[:message] = e.message
36
- hash[:location] = e.backtrace
33
+ exception = failure.exception
34
+ unless exception.nil?
35
+ hash[:class] = exception.class.name
36
+ hash[:message] = exception.message
37
+ hash[:location] = exception.backtrace
37
38
  end
38
39
  end
39
40
  end
40
41
  end
41
42
 
42
- def close
43
+ def failures(notification)
44
+ if !notification.nil?
45
+ notification.examples.select { |e| e.execution_result.status == :failed }
46
+ else
47
+ examples.select { |e| e.execution_result[:status] == "failed" }
48
+ end
49
+ end
50
+
51
+ def close(_notification=nil)
43
52
  output.write @failures.to_json
44
53
  output.close if IO === output && output != $stdout
45
54
  end
@@ -32,6 +32,7 @@ class RspecRunner
32
32
  def keep_config_modules
33
33
  orig_configuration = ::RSpec.configuration.clone
34
34
  yield
35
+ RSpec.reset
35
36
  ::RSpec.instance_variable_set(:@configuration, orig_configuration)
36
37
  end
37
38
  end
@@ -1,3 +1,3 @@
1
1
  module Gorgon
2
- VERSION = "0.9.0"
2
+ VERSION = "0.10.0"
3
3
  end
@@ -60,4 +60,16 @@ describe RSpec::Core::Formatters::GorgonRspecFormatter do
60
60
  @formatter.stop
61
61
  @formatter.close
62
62
  end
63
+
64
+ it "uses RSpec 3 API when available" do
65
+ fail_example.execution_result.should_receive(:status).and_return(:failed)
66
+ notification = double(examples: [fail_example])
67
+
68
+ expected_result = [{:test_name => "Full_Description: line 2", :description => "description",
69
+ :full_description => "Full_Description", :status => "failed",
70
+ :file_path => "path/to/file", :line_number => 2}]
71
+ output.should_receive(:write).with(expected_result.to_json)
72
+ @formatter.stop(notification)
73
+ @formatter.close
74
+ end
63
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorgon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Fitzsimmons
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-05-04 00:00:00.000000000 Z
15
+ date: 2015-05-24 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rake