allure-ruby-adaptor-api 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5dcc22bb2304ee0ee59e7e205ac28668abdd1dd
4
- data.tar.gz: b04cecf8cd87609c6aa058b60a6c1964375954a5
3
+ metadata.gz: 27837ff6b9eb83bdb943e375d766a683b288d7d8
4
+ data.tar.gz: 08555e5992f1ef918e9d287efde0db0d676f98ec
5
5
  SHA512:
6
- metadata.gz: e7c0bdd25d16efda3508d463b8a6b9139e5270e64a55b3afe290f59b7c80d82937b6a6c1771effaf8863fa87220e40107d400df098f906e32d6d5d39e9b36dbe
7
- data.tar.gz: 9f2425edf17e58ce31706e9959e6459c66a8aa9d9226acaca845c463bb647189c37813f34854713e12633f58d51b38c9605b3ee5ee7ce48be1c1c5b314e907e7
6
+ metadata.gz: e63ed1e8a6790b471f4439bbc5f15922c32bf492f64cab993697f61922d0dd1128b517335ca5e2646e18901c14c74bfa54b0582239acfe62fe768ee3ee2177a2
7
+ data.tar.gz: 1b2c28606153bdc0b776d6688ade612ce7f44ed5be107726997d1f4e6f4b39131bec85277289d409a9fa08dfcd8261b99b92f1c7a6ded9f7cf6702640ca61a10
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- allure-ruby-adaptor-api (0.6.3)
4
+ allure-ruby-adaptor-api (0.6.4)
5
5
  mimemagic
6
6
  nokogiri (~> 1.6.0)
7
7
  uuid
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2014 YANDEX
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md CHANGED
@@ -26,19 +26,20 @@ your current directory.
26
26
  ## Usage examples
27
27
 
28
28
  ```ruby
29
- AllureRubyAdaptorApi::Builder.start_suite "some_suite", :severity => :normal
30
- AllureRubyAdaptorApi::Builder.start_test "some_suite", "some_test", :feature => "Some feature", :severity => :critical
31
- AllureRubyAdaptorApi::Builder.start_step "some_suite", "some_test", "first step"
32
- AllureRubyAdaptorApi::Builder.add_attachment "some_suite", "some_test", :file => Tempfile.new("somefile")
33
- AllureRubyAdaptorApi::Builder.stop_step "some_suite", "some_test", "first step"
34
- AllureRubyAdaptorApi::Builder.start_step "some_suite", "some_test", "second step"
35
- AllureRubyAdaptorApi::Builder.add_attachment "some_suite", "some_test", :step => "second step", :file => Tempfile.new("somefile")
36
- AllureRubyAdaptorApi::Builder.stop_step "some_suite", "some_test", "second step"
37
- AllureRubyAdaptorApi::Builder.start_step "some_suite", "some_test", "third step"
38
- AllureRubyAdaptorApi::Builder.stop_step "some_suite", "some_test", "third step", :failed
39
- AllureRubyAdaptorApi::Builder.stop_test "some_suite", "some_test", :status => :broken, :exception => Exception.new("some error")
40
- AllureRubyAdaptorApi::Builder.stop_suite "some_suite"
29
+ builder = AllureRubyAdaptorApi::Builder
30
+ builder.start_suite "some_suite", :severity => :normal
31
+ builder.start_test "some_suite", "some_test", :feature => "Some feature", :severity => :critical
32
+ builder.start_step "some_suite", "some_test", "first step"
33
+ builder.add_attachment "some_suite", "some_test", :file => Tempfile.new("somefile")
34
+ builder.stop_step "some_suite", "some_test", "first step"
35
+ builder.start_step "some_suite", "some_test", "second step"
36
+ builder.add_attachment "some_suite", "some_test", :step => "second step", :file => Tempfile.new("somefile")
37
+ builder.stop_step "some_suite", "some_test", "second step"
38
+ builder.start_step "some_suite", "some_test", "third step"
39
+ builder.stop_step "some_suite", "some_test", "third step", :failed
40
+ builder.stop_test "some_suite", "some_test", :status => :broken, :exception => Exception.new("some error")
41
+ builder.stop_suite "some_suite"
41
42
 
42
43
  # This will generate the results within your output directory
43
- AllureRubyAdaptorApi::Builder.build!
44
+ builder.build!
44
45
  ```
@@ -46,7 +46,7 @@ module AllureRubyAdaptorApi
46
46
  MUTEX.synchronize do
47
47
  puts "Stopping test #{suite}.#{test}"
48
48
  self.suites[suite][:tests][test][:stop] = timestamp(result[:finished_at])
49
- self.suites[suite][:tests][test][:start] = timestamp(result[:started_at])
49
+ self.suites[suite][:tests][test][:start] = timestamp(result[:started_at]) if result[:started_at]
50
50
  self.suites[suite][:tests][test][:status] = result[:status]
51
51
  if (result[:status].to_sym != :passed)
52
52
  self.suites[suite][:tests][test][:failure] = {
@@ -149,16 +149,18 @@ module AllureRubyAdaptorApi
149
149
  xml_labels(xml, suite[:labels])
150
150
  end
151
151
  end
152
- xml = builder.to_xml
153
- xml = yield suite, xml if block_given?
154
- dir = Pathname.new(config.output_dir)
155
- FileUtils.mkdir_p(dir)
156
- out_file = dir.join("#{UUID.new.generate}-testsuite.xml")
157
- puts "Writing file '#{out_file}'..."
158
- File.open(out_file, 'w+') do |file|
159
- file.write(validate_xml(xml))
152
+ unless suite[:tests].empty?
153
+ xml = builder.to_xml
154
+ xml = yield suite, xml if block_given?
155
+ dir = Pathname.new(config.output_dir)
156
+ FileUtils.mkdir_p(dir)
157
+ out_file = dir.join("#{UUID.new.generate}-testsuite.xml")
158
+ puts "Writing file '#{out_file}'..."
159
+ File.open(out_file, 'w+') do |file|
160
+ file.write(validate_xml(xml))
161
+ end
162
+ suites_xml << xml
160
163
  end
161
- suites_xml << xml
162
164
  end
163
165
  suites_xml
164
166
  end
@@ -1,6 +1,6 @@
1
1
  module AllureRubyAdaptorApi # :nodoc:
2
2
  module Version # :nodoc:
3
- STRING = '0.6.3'
3
+ STRING = '0.6.4'
4
4
  ALLURE = '1.4.0'
5
5
  end
6
6
  end
@@ -17,6 +17,9 @@ describe AllureRubyAdaptorApi do
17
17
  builder.stop_test "some_suite", "some_test", :status => :broken, :exception => Exception.new("some error")
18
18
  builder.stop_suite "some_suite"
19
19
 
20
+ builder.start_suite "some_empty_suite"
21
+ builder.stop_suite "some_empty_suite"
22
+
20
23
  builder.build! {|suite, xml|
21
24
  xml.should_not be_empty
22
25
  xml.should include("<ns2:test-suite")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allure-ruby-adaptor-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Sadykov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-20 00:00:00.000000000 Z
11
+ date: 2014-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -91,12 +91,12 @@ files:
91
91
  - .gitignore
92
92
  - Gemfile
93
93
  - Gemfile.lock
94
+ - LICENSE
94
95
  - README.md
95
96
  - allure-model-1.4.0.xsd
96
97
  - allure-ruby-adaptor-api.gemspec
97
98
  - lib/allure-ruby-adaptor-api.rb
98
99
  - lib/allure-ruby-adaptor-api/builder.rb
99
- - lib/allure-ruby-adaptor-api/dsl.rb
100
100
  - lib/allure-ruby-adaptor-api/version.rb
101
101
  - spec/extend_steps_spec.rb
102
102
  - spec/spec_helper.rb
@@ -123,6 +123,6 @@ rubyforge_project:
123
123
  rubygems_version: 2.0.3
124
124
  signing_key:
125
125
  specification_version: 4
126
- summary: allure-ruby-adaptor-api-0.6.3
126
+ summary: allure-ruby-adaptor-api-0.6.4
127
127
  test_files: []
128
128
  has_rdoc:
@@ -1,35 +0,0 @@
1
- require 'digest'
2
- require 'mimemagic'
3
- module AllureRubyAdaptorApi
4
- module DSL
5
-
6
-
7
- def step(step, &block)
8
- suite = self.example.metadata[:example_group][:description_args].first
9
- test = self.example.metadata[:description]
10
- AllureRSpec::Builder.start_step(suite, test, step)
11
- __with_step step, &block
12
- AllureRSpec::Builder.stop_step(suite, test, step)
13
- end
14
-
15
- def attach_file(title, file, mime_type = nil)
16
- step = current_step
17
- dir = Pathname.new(AllureRSpec::Config.output_dir)
18
- FileUtils.mkdir_p(dir)
19
- file_extname = File.extname(file.path.downcase)
20
- mime_type ||= MimeMagic.by_path(file.path) || "text/plain"
21
- attachment = dir.join("#{Digest::SHA256.file(file.path).hexdigest}-attachment#{(file_extname.empty?) ? '' : file_extname}")
22
- FileUtils.cp(file.path, attachment)
23
- suite = self.example.metadata[:example_group][:description_args].first
24
- test = self.example.metadata[:description]
25
- AllureRubyAdaptorApi::Builder.add_attachment(suite, test, {
26
- :type => type,
27
- :title => title,
28
- :source => attachment.basename,
29
- :size => File.stat(attachment).size,
30
- :mime_type => mime_type
31
- }, step)
32
- end
33
- end
34
- end
35
-