test_rail_integration 0.0.7.9 → 0.0.8

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dff67be18ea8fd2be4061b4e7f4ba8e988f7aef1
4
- data.tar.gz: 4bf9f88a8c59e45b99a18b8ef4e215ba7c778c56
3
+ metadata.gz: 13341bbacfa47b3faa6fc70d351428b9147107d8
4
+ data.tar.gz: 7b0ab5e7c9b5b069bb7fe287f47b415593b42528
5
5
  SHA512:
6
- metadata.gz: f86d6a48de8fc03b30b24aa825827a3c5ff7b66efac32d1dc9e314fd79ebba59e2ae44e1eb569d29c4d56467ebb22bc7c2a13d172865bf2fdd4027cae6436f64
7
- data.tar.gz: cd2b772279bb8e8e1646b5a1874c8f6a1c4db170def0cf95f7e22e2beb5dc30c92c91cf0d9c75c77a7aa1f36e86b6258061b5ecbe6ce18171ab04449e49e9d5b
6
+ metadata.gz: 83e20371b6c3cbba3a4ee7bf88ef3d086477b5c284ddb0e704fb0f393e4f13f2acbb86bf67620a39545ebfe72c87773cd28e558166d40f6aa8d387e55ba79de5
7
+ data.tar.gz: c8ba5f06e1d6623b78794996cc95ed2881f8aa4e0bd9e6882345f1c3735d61dc2113cab92b6f72899c5fb94ea2e97d59c70f5e43a784d56b8d1606401c75ce6f
@@ -14,7 +14,7 @@ class CLI < Thor
14
14
  desc "check_test_run_and_update", "Check test run statuses and update"
15
15
 
16
16
  def check_test_run_and_update
17
- TestRail::CheckTestRun.check
17
+ TestRail::Check.check_test_run_statuses
18
18
  end
19
19
  end
20
20
 
@@ -5,17 +5,20 @@ require_relative '../../generator/test_rail_tools'
5
5
 
6
6
  module TestRail
7
7
 
8
- class CheckTestRun
8
+ class Check
9
+
10
+
11
+ def self.check_test_run_statuses
12
+ start_time = Time.new
13
+ results = []
9
14
 
10
- def self.check
11
15
  test_cases_id = Connection.cases_with_types
12
16
  test_cases_id.each do |test_case|
13
17
 
14
18
  test_results = Connection.get_test_result(test_case).map { |status_hash| status_hash["status_id"] }
15
19
  if test_results.include?(TestCaseResult::COMMENT[:fail][:status]) && test_results.include?(TestCaseResult::COMMENT[:pass][:status])
16
- fail_indexes = Connection.get_indexes_of_fails(test_case)
17
- pass_indexes = Connection.get_test_result(test_case).map.with_index { |result, index| result["status_id"] == TestCaseResult::COMMENT[:pass][:status] ? index : nil }
18
- pass_indexes.compact!
20
+ fail_indexes = test_results.map.with_index{ |element, index| element == TestCaseResult::COMMENT[:fail][:status] ? index : nil }.compact
21
+ pass_indexes = test_results.map.with_index{ |element, index| element == TestCaseResult::COMMENT[:pass][:status] ? index : nil }.compact
19
22
 
20
23
  if pass_indexes.first < fail_indexes.first
21
24
  scenario = Connection.get_case_info(test_case)
@@ -23,11 +26,15 @@ module TestRail
23
26
  test_case_result.comment ||= TestRail::TestCaseResult::COMMENT[:fail]
24
27
  TestRail::Connection.commit_test_result(test_case_result)
25
28
 
26
- p test_case_result
27
- return test_case_result
29
+ p test_case_result.test_case_id
30
+ p test_case_result.title
31
+ results.push(test_case_result)
28
32
  end
29
33
  end
30
34
  end
35
+ end_time = Time.now - start_time
36
+ p "Time for run = #{end_time} seconds"
37
+ results
31
38
  end
32
39
 
33
40
  end
@@ -8,8 +8,8 @@ require 'test_rail_integration/generator/test_run_creation'
8
8
  require 'test_rail_integration/generator/test_rail_tools'
9
9
 
10
10
  module TestRail
11
- unless TestRailIntegration::TestRail::Generators::Project.test_rail_data_file_exist?
12
- TestRailIntegration::TestRail::Generators::Project.copy_file("test_rail_data.yml")
11
+ unless Generators::Project.test_rail_data_file_exist?
12
+ Generators::Project.copy_file("test_rail_data.yml")
13
13
  raise "Please fill all required data in test rail data yml file"
14
14
  end
15
15
 
@@ -1,3 +1,3 @@
1
1
  module TestRailIntegration
2
- VERSION = "0.0.7.9"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'rspec'
2
2
  require_relative '../lib/test_rail_integration/generator/connection'
3
- require_relative '../lib/test_rail_integration/generator/project/check_test_run'
3
+ require_relative '../lib/test_rail_integration/generator/project/check'
4
4
 
5
5
  describe 'Checking test run' do
6
6
 
@@ -13,9 +13,20 @@ describe 'Checking test run' do
13
13
  allow(TestRail::Connection).to receive(:get_case_info).and_return({id: 1011, "title" => 'MLP'})
14
14
  allow(TestRail::Connection).to receive(:commit_test_result).and_return([])
15
15
 
16
- test_case_result = TestRail::CheckTestRun.check
17
- expect(test_case_result.title).to eq('MLP')
18
- expect(test_case_result.comment).to eq({:status => 5, :comment => "test **failed:**"})
16
+ test_case_results = TestRail::Check.check_test_run_statuses
17
+ expect(test_case_results[0].title).to eq('MLP')
18
+ expect(test_case_results[0].comment).to eq({:status => 5, :comment => "test **failed:**"})
19
+ end
20
+
21
+ it "should call api twice" do
22
+
23
+ allow(TestRail::Connection).to receive(:cases_with_types).and_return([1011, 1213])
24
+ allow(TestRail::Connection).to receive(:get_test_result).and_return([{"status_id" => 1, :comment => "FTW"}, {"status_id" => 5, :comment => "Burn heretics"}] )
25
+ allow(TestRail::Connection).to receive(:get_case_info).and_return({id: 1011, "title" => 'MLP'})
26
+ allow(TestRail::Connection).to receive(:commit_test_result).and_return([])
27
+
28
+ test_case_results = TestRail::Check.check_test_run_statuses
29
+ expect(test_case_results.length).to eq 2
19
30
  end
20
31
  end
21
32
  end
@@ -0,0 +1,91 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = true
41
+ end
42
+
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
52
+
53
+ # Limits the available syntax to the non-monkey patched syntax that is
54
+ # recommended. For more details, see:
55
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
56
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
57
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
58
+ config.disable_monkey_patching!
59
+
60
+ # This setting enables warnings. It's recommended, but in some cases may
61
+ # be too noisy due to issues in dependencies.
62
+ config.warnings = true
63
+
64
+ # Many RSpec users commonly either run the entire suite or an individual
65
+ # file, and it's useful to allow more verbose output when running an
66
+ # individual spec file.
67
+ if config.files_to_run.one?
68
+ # Use the documentation formatter for detailed output,
69
+ # unless a formatter has already been configured
70
+ # (e.g. via a command-line flag).
71
+ config.default_formatter = 'doc'
72
+ end
73
+
74
+ # Print the 10 slowest examples and example groups at the
75
+ # end of the spec run, to help surface which specs are running
76
+ # particularly slow.
77
+ config.profile_examples = 10
78
+
79
+ # Run specs in random order to surface order dependencies. If you find an
80
+ # order dependency and want to debug it, you can fix the order by providing
81
+ # the seed, which is printed after each run.
82
+ # --seed 1234
83
+ config.order = :random
84
+
85
+ # Seed global randomization in this process using the `--seed` CLI option.
86
+ # Setting this allows you to use `--seed` to deterministically reproduce
87
+ # test failures related to randomization by passing the same `--seed` value
88
+ # as the one that triggered the failure.
89
+ Kernel.srand config.seed
90
+ =end
91
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_rail_integration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7.9
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirikami
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-18 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -168,7 +168,7 @@ files:
168
168
  - lib/test_rail_integration/generator/API_client.rb
169
169
  - lib/test_rail_integration/generator/connection.rb
170
170
  - lib/test_rail_integration/generator/project.rb
171
- - lib/test_rail_integration/generator/project/check_test_run.rb
171
+ - lib/test_rail_integration/generator/project/check.rb
172
172
  - lib/test_rail_integration/generator/project/run_test_run.rb
173
173
  - lib/test_rail_integration/generator/project/test_rail_data.yml
174
174
  - lib/test_rail_integration/generator/test_case_result.rb
@@ -179,6 +179,7 @@ files:
179
179
  - lib/test_rail_integration/generator/test_run_parameters.rb
180
180
  - lib/test_rail_integration/version.rb
181
181
  - spec/check_test_run_spec.rb
182
+ - spec/spec_helper.rb
182
183
  - test_rail_integration.gemspec
183
184
  homepage: https://github.com/Kirikami/test_rail_integration
184
185
  licenses:
@@ -206,3 +207,4 @@ specification_version: 4
206
207
  summary: Gem for integration between framework and TestRail API
207
208
  test_files:
208
209
  - spec/check_test_run_spec.rb
210
+ - spec/spec_helper.rb