testcentricity_web 2.0.14 → 2.0.15

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: 523b1d2ca673c7114b6579548229ca29160ee3f1
4
- data.tar.gz: 43b79c51ae36218dbd7241c3c0279a155fc20a30
3
+ metadata.gz: 79ac6acd9e66f7fabdd0f638a313701152dde97d
4
+ data.tar.gz: 6f4358684c4e9a919162d3d83ef7180a7032a59a
5
5
  SHA512:
6
- metadata.gz: d6d20f7a081a3d5eab4ab4c019b7b4b48f1f875ec1071e521855caf45ff75e8eae9b1caf3ad1f03ccbcd83d5915df9ed37b312e9373944077bcf8f5768bf8181
7
- data.tar.gz: f516097d1004984178857b641453970fab3e00c3a73e5c2848c23cbf97e03e7c5fd9ce207af163bf7afd42e635ad4ea187c1829063567c2f07c8d44adc8df07f
6
+ metadata.gz: 9a776a8fa933be0c746a5858dd89d0788f35c68aff2d3cf9935a8342c71bd396b736a81a253be35caf0a588cf1f1af8d77cca55c533419122b491386d1ab0bcf
7
+ data.tar.gz: d4928cb6be15d9c65a66e2d86898ec3436c95a2fd0dfdca38c1855af79377d0c26e263e5457ee8fff727d4484c0a5adf87b698ec5f31e69eb578b061d4eb48f9
@@ -6,20 +6,69 @@ module TestCentricity
6
6
  include Capybara::Node::Matchers
7
7
  include Test::Unit::Assertions
8
8
 
9
- attr_reader :locator, :context, :name
9
+ attr_reader :context, :name
10
+ attr_accessor :locator
10
11
  attr_accessor :parent
12
+ attr_accessor :parent_list
13
+ attr_accessor :list_index
14
+
11
15
 
12
16
  def initialize(name, parent, locator, context)
13
- @name = name
14
- @parent = parent
15
- @locator = locator
16
- @context = context
17
+ @name = name
18
+ @parent = parent
19
+ @locator = locator
20
+ @context = context
21
+ @parent_list = nil
22
+ @list_index = nil
23
+ end
24
+
25
+ def get_locator
26
+ if @locator.empty? && defined?(section_locator)
27
+ locator = section_locator
28
+ else
29
+ locator = @locator
30
+ end
31
+
32
+ unless @parent_list.nil?
33
+ locator = "#{@parent_list.get_locator}|#{locator}"
34
+ unless @list_index.nil?
35
+ if locator.include?('/')
36
+ locator = "(#{locator})[#{@list_index}]"
37
+ else
38
+ locator = "#{locator}:nth-of-type(#{@list_index})"
39
+ end
40
+ end
41
+ end
42
+
43
+ if @context == :section && !@parent.nil? && !@parent.get_locator.nil?
44
+ "#{@parent.get_locator}|#{locator}"
45
+ else
46
+ locator
47
+ end
48
+ end
49
+
50
+ def set_list_index(list, index = 1)
51
+ @parent_list = list unless list.nil?
52
+ @list_index = index
53
+ end
54
+
55
+ def get_item_count
56
+ raise 'No parent list defined' if @parent_list.nil?
57
+ @parent_list.get_item_count
17
58
  end
18
59
 
19
60
  def get_object_type
20
61
  :section
21
62
  end
22
63
 
64
+ def get_name
65
+ @name
66
+ end
67
+
68
+ def set_parent(parent)
69
+ @parent = parent
70
+ end
71
+
23
72
  # Define a trait for this page section.
24
73
  #
25
74
  # @param trait_name [Symbol] name of trait (as a symbol)
@@ -385,27 +434,6 @@ module TestCentricity
385
434
  end
386
435
  end
387
436
 
388
- def get_locator
389
- if @locator.empty? && defined?(section_locator)
390
- locator = section_locator
391
- else
392
- locator = @locator
393
- end
394
- if @context == :section && !@parent.nil? && !@parent.get_locator.nil?
395
- "#{@parent.get_locator}|#{locator}"
396
- else
397
- locator
398
- end
399
- end
400
-
401
- def get_name
402
- @name
403
- end
404
-
405
- def set_parent(parent)
406
- @parent = parent
407
- end
408
-
409
437
  # Does Section object exists?
410
438
  #
411
439
  # @return [Boolean]
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '2.0.14'
2
+ VERSION = '2.0.15'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcentricity_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.14
4
+ version: 2.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.J. Mrozinski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-20 00:00:00.000000000 Z
11
+ date: 2017-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler