calios-uikit-extension 0.0.7 → 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: c9cca12ae4e14e5cf8739415fbeee0f09845ebd3
4
- data.tar.gz: 5f97532ab707c2c8ec5515fdccdbe9a102abbe75
3
+ metadata.gz: bf2c6836c402524d47729114143f817a3f247eea
4
+ data.tar.gz: a9fe44c45fe6f7499e1e9ffe85a1ccc04868fe81
5
5
  SHA512:
6
- metadata.gz: 6d8753dc90cb213449b612d1ee47e155da87d44153bf2988104a645c38ffdfb729fcf8249f971f67b794ef42bce446719da605cc9855203428f111332e2784b5
7
- data.tar.gz: f4157e2a6ee1c0e54402c92fe65c61f0e29abd5549b73b958b3847b64b144c19296d9de52895262f4edb3d10738219024287420d184e99dcdcead520105b189b
6
+ metadata.gz: aad1a9df98572eced63f6aa0387cd90134015e2e488da4d2bd8a0e5380801c8022925fc01a5fa5b8610a18bf69d6c5a96e0eb8a0bca091b0468dc052a52cf6af
7
+ data.tar.gz: 9519d35c3e71ea7f62936feb47145f706004ea02de0fcb9e36e7f45fb7dbe18059bcd59970bbb24668de12e3a34e81c2c257f9495e023fb3daa74b833a7e3ea0
@@ -1,5 +1,10 @@
1
+ # rubocop:disable Metrics/LineLength
2
+
1
3
  include Calabash::Cucumber::Core
2
4
 
5
+ #
6
+ # Base class for UIKit elements
7
+ #
3
8
  class UIBase
4
9
  class << self
5
10
  def class_name
@@ -7,37 +12,37 @@ class UIBase
7
12
  end
8
13
 
9
14
  def property(*aParams)
10
- Calabash::Cucumber::Core.query(self.class_name, *aParams)
15
+ Calabash::Cucumber::Core.query(class_name, *aParams)
11
16
  end
12
17
 
13
18
  alias_method :prop, :property
14
19
  alias_method :p, :property
15
20
 
16
- def enabled?(aIdOrIndex=nil)
17
- q = self.parse_query(aIdOrIndex)
21
+ def enabled?(aIdOrIndex = nil)
22
+ q = parse_query(aIdOrIndex)
18
23
  Calabash::Cucumber::Core.query(q, :isEnabled).first.to_boolean
19
24
  end
20
25
 
21
- def touch(aIdOrIndex=nil)
22
- q = self.parse_query(aIdOrIndex)
26
+ def touch(aIdOrIndex = nil)
27
+ q = parse_query(aIdOrIndex)
23
28
  Calabash::Cucumber::Core.touch(q)
24
29
  end
25
30
 
26
31
  alias_method :tap, :touch
27
32
 
28
- def double_tap(aIdOrIndex=nil)
29
- q = self.parse_query(aIdOrIndex)
33
+ def double_tap(aIdOrIndex = nil)
34
+ q = parse_query(aIdOrIndex)
30
35
  Calabash::Cucumber::Core.double_tap(q)
31
36
  end
32
37
 
33
- def query(aIdOrIndex=nil)
38
+ def query(aIdOrIndex = nil)
34
39
  q = parse_query(aIdOrIndex)
35
40
  Calabash::Cucumber::Core.query(q)
36
41
  end
37
42
 
38
43
  alias_method :q, :query
39
44
 
40
- def flash(aIdOrIndex=nil)
45
+ def flash(aIdOrIndex = nil)
41
46
  q = parse_query(aIdOrIndex)
42
47
  Calabash::Cucumber::Core.flash(q)
43
48
  end
@@ -45,13 +50,13 @@ class UIBase
45
50
  alias_method :f, :flash
46
51
 
47
52
  def accessibility_label
48
- self.property(:accessibilityLabel)
53
+ property(:accessibilityLabel)
49
54
  end
50
55
 
51
56
  alias_method :label, :accessibility_label
52
57
 
53
58
  def accessibility_identifier
54
- self.property(:accessibilityIdentifier)
59
+ property(:accessibilityIdentifier)
55
60
  end
56
61
 
57
62
  alias_method :identifier, :accessibility_identifier
@@ -63,21 +68,21 @@ class UIBase
63
68
  alias_method :h, :help
64
69
 
65
70
  def parse_query(aIdOrIndex)
66
- raise_if_invalid(aIdOrIndex)
71
+ fail_if_invalid(aIdOrIndex)
67
72
 
68
73
  if aIdOrIndex.nil?
69
- qStr = "#{self.class_name}"
74
+ q = "#{class_name}"
70
75
  else
71
- qStr = aIdOrIndex.is_a?(String) ? "#{self.class_name} marked:'#{aIdOrIndex}'" : "#{self.class_name} index:#{aIdOrIndex}"
76
+ q = aIdOrIndex.is_a?(String) ? "#{class_name} marked:'#{aIdOrIndex}'" : "#{class_name} index:#{aIdOrIndex}"
72
77
  end
73
78
 
74
- qStr
79
+ q
75
80
  end
76
81
 
77
82
  private
78
83
 
79
- def raise_if_invalid(aParam)
80
- raise('invalid parameter') unless aParam.nil? || aParam.is_a?(String) || aParam.is_a?(Integer)
84
+ def fail_if_invalid(aParam)
85
+ Kernel.fail('invalid parameter') unless aParam.nil? || aParam.is_a?(String) || aParam.is_a?(Integer)
81
86
  end
82
87
  end
83
88
  end
@@ -1,14 +1,17 @@
1
1
  require_relative 'ui_base'
2
2
 
3
+ #
4
+ # Provides methods for UIButton elements
5
+ #
3
6
  class UIButton < UIBase
4
7
  class << self
5
- def text(aIdOrIndex=nil)
6
- q = self.parse_query(aIdOrIndex)
8
+ def text(aIdOrIndex = nil)
9
+ q = parse_query(aIdOrIndex)
7
10
  Calabash::Cucumber::Core.query(q, :currentTitle).first
8
11
  end
9
12
 
10
- def selected?(aIdOrIndex=nil)
11
- q = self.parse_query(aIdOrIndex)
13
+ def selected?(aIdOrIndex = nil)
14
+ q = parse_query(aIdOrIndex)
12
15
  Calabash::Cucumber::Core.query(q, :isSelected).first.to_boolean
13
16
  end
14
17
  end
@@ -1,21 +1,28 @@
1
+ # rubocop:disable Metrics/LineLength
2
+ # rubocop:disable Style/SpaceAfterColon
3
+ # rubocop:disable Style/BracesAroundHashParameters
4
+
1
5
  require_relative 'ui_base'
2
6
 
7
+ #
8
+ # Provides methods for UICollectionView elements
9
+ #
3
10
  class UICollectionView < UIBase
4
11
  class << self
5
- def number_of_items_in_section(aSection=0)
6
- Calabash::Cucumber::Core.query("#{self.class_name}", numberOfItemsInSection:aSection).first
12
+ def number_of_items_in_section(aSection = 0)
13
+ Calabash::Cucumber::Core.query("#{class_name}", numberOfItemsInSection:aSection).first
7
14
  end
8
15
 
9
16
  def scroll_to_item(aItem, aSection, aScrollPosition)
10
- scroll_to_collection_view_item(aItem, aSection, {scroll_position: aScrollPosition})
17
+ scroll_to_collection_view_item(aItem, aSection, { scroll_position: aScrollPosition })
11
18
  end
12
19
 
13
20
  def scroll(aDirection)
14
- Calabash::Cucumber::Core.scroll(self.class_name, aDirection)
21
+ Calabash::Cucumber::Core.scroll(class_name, aDirection)
15
22
  end
16
23
 
17
- def empty?(aIdOrIndex=nil)
18
- q = self.parse_query(aIdOrIndex)
24
+ def empty?(aIdOrIndex = nil)
25
+ q = parse_query(aIdOrIndex)
19
26
  Calabash::Cucumber::Core.query(q).empty?
20
27
  end
21
28
  end
@@ -1,13 +1,16 @@
1
1
  require_relative 'ui_base'
2
2
 
3
+ #
4
+ # Provides methods for UICollectionViewCell elements
5
+ #
3
6
  class UICollectionViewCell < UIBase
4
7
  class << self
5
8
  def count
6
- Calabash::Cucumber::Core.query("#{self.class_name}").count
9
+ Calabash::Cucumber::Core.query("#{class_name}").count
7
10
  end
8
11
 
9
- def selected?(aIdOrIndex=nil)
10
- q = self.parse_query(aIdOrIndex)
12
+ def selected?(aIdOrIndex = nil)
13
+ q = parse_query(aIdOrIndex)
11
14
  Calabash::Cucumber::Core.query(q, :isSelected).first.to_boolean
12
15
  end
13
16
  end
@@ -1,5 +1,8 @@
1
1
  require_relative 'ui_base'
2
2
 
3
+ #
4
+ # Provides methods for UIKeyboardAutomatic elements
5
+ #
3
6
  class UIKeyboardAutomatic < UIBase
4
7
  class << self
5
8
  # Nothing here yet
@@ -1,9 +1,12 @@
1
1
  require_relative 'ui_base'
2
2
 
3
+ #
4
+ # Provides methods for UILabel elements
5
+ #
3
6
  class UILabel < UIBase
4
7
  class << self
5
- def text(aIdOrIndex=nil)
6
- q = self.parse_query(aIdOrIndex)
8
+ def text(aIdOrIndex = nil)
9
+ q = parse_query(aIdOrIndex)
7
10
  Calabash::Cucumber::Core.query(q, :text).first
8
11
  end
9
12
  end
@@ -1,5 +1,8 @@
1
1
  require_relative 'ui_base'
2
2
 
3
+ #
4
+ # Provides methods for UINavigationBar elements
5
+ #
3
6
  class UINavigationBar < UIBase
4
7
  class << self
5
8
  # Nothing here yet
@@ -1,9 +1,12 @@
1
1
  require_relative 'ui_base'
2
2
 
3
+ #
4
+ # Provides methods for UISearchBar elements
5
+ #
3
6
  class UISearchBar < UIBase
4
7
  class << self
5
- def text(aIdOrIndex=nil)
6
- q = self.parse_query(aIdOrIndex)
8
+ def text(aIdOrIndex = nil)
9
+ q = parse_query(aIdOrIndex)
7
10
  Calabash::Cucumber::Core.query(q, :text).first
8
11
  end
9
12
  end
@@ -1,14 +1,17 @@
1
1
  require_relative 'ui_base'
2
2
 
3
+ #
4
+ # Provides methods for UISegmentedControl elements
5
+ #
3
6
  class UISegmentedControl < UIBase
4
7
  class << self
5
- def number_of_segments(aIdOrIndex=nil)
6
- q = self.parse_query(aIdOrIndex)
8
+ def number_of_segments(aIdOrIndex = nil)
9
+ q = parse_query(aIdOrIndex)
7
10
  Calabash::Cucumber::Core.query(q, :numberOfSegments).first
8
11
  end
9
12
 
10
- def selected_segment_index(aIdOrIndex=nil)
11
- q = self.parse_query(aIdOrIndex)
13
+ def selected_segment_index(aIdOrIndex = nil)
14
+ q = parse_query(aIdOrIndex)
12
15
  Calabash::Cucumber::Core.query(q, :selectedSegmentIndex).first
13
16
  end
14
17
  end
@@ -1,9 +1,12 @@
1
1
  require_relative 'ui_base'
2
2
 
3
+ #
4
+ # Provides methods for UISwitch elements
5
+ #
3
6
  class UISwitch < UIBase
4
7
  class << self
5
- def on?(aIdOrIndex=nil)
6
- q = self.parse_query(aIdOrIndex)
8
+ def on?(aIdOrIndex = nil)
9
+ q = parse_query(aIdOrIndex)
7
10
  Calabash::Cucumber::Core.query(q, :isOn).first.to_boolean
8
11
  end
9
12
  end
@@ -1,9 +1,12 @@
1
1
  require_relative 'ui_base'
2
2
 
3
+ #
4
+ # Provides methods for UITableView elements
5
+ #
3
6
  class UITableView < UIBase
4
7
  class << self
5
8
  def scroll(aDirection)
6
- Calabash::Cucumber::Core.scroll(self.class_name, aDirection)
9
+ Calabash::Cucumber::Core.scroll(class_name, aDirection)
7
10
  end
8
11
  end
9
12
  end
@@ -1,18 +1,21 @@
1
1
  require_relative 'ui_base'
2
2
 
3
+ #
4
+ # Provides methods for UITableViewCell elements
5
+ #
3
6
  class UITableViewCell < UIBase
4
7
  class << self
5
8
  def count
6
- Calabash::Cucumber::Core.query("#{self.class_name}").count
9
+ Calabash::Cucumber::Core.query("#{class_name}").count
7
10
  end
8
11
 
9
- def text(aIdOrIndex=nil)
10
- q = self.parse_query(aIdOrIndex)
12
+ def text(aIdOrIndex = nil)
13
+ q = parse_query(aIdOrIndex)
11
14
  Calabash::Cucumber::Core.query(q, :text).first
12
15
  end
13
16
 
14
- def selected?(aIdOrIndex=nil)
15
- q = self.parse_query(aIdOrIndex)
17
+ def selected?(aIdOrIndex = nil)
18
+ q = parse_query(aIdOrIndex)
16
19
  Calabash::Cucumber::Core.query(q, :isSelected).first.to_boolean
17
20
  end
18
21
  end
@@ -1,9 +1,12 @@
1
1
  require_relative 'ui_base'
2
2
 
3
+ #
4
+ # Provides methods for UITextField elements
5
+ #
3
6
  class UITextField < UIBase
4
7
  class << self
5
- def text(aIdOrIndex=nil)
6
- q = self.parse_query(aIdOrIndex)
8
+ def text(aIdOrIndex = nil)
9
+ q = parse_query(aIdOrIndex)
7
10
  Calabash::Cucumber::Core.query(q, :text).first
8
11
  end
9
12
  end
@@ -1,5 +1,8 @@
1
1
  require_relative 'ui_base'
2
2
 
3
+ #
4
+ # Provides methods for UIView elements
5
+ #
3
6
  class UIView < UIBase
4
7
  class << self
5
8
  # Nothing here yet
@@ -1,3 +1,6 @@
1
+ #
2
+ # Gem version
3
+ #
1
4
  module CaliosUIKitExtension
2
- VERSION = '0.0.7'
5
+ VERSION = '0.0.8'
3
6
  end
data/spec/spec_ui_base.rb CHANGED
@@ -114,7 +114,7 @@ class SpecUIBase < Minitest::Spec
114
114
  end
115
115
  end
116
116
 
117
- describe 'UIBase.raise_if_invalid' do
117
+ describe 'UIBase.fail_if_invalid' do
118
118
  it 'should raise' do
119
119
  proc { UIButton.text(:symbol) }.must_raise(RuntimeError)
120
120
  proc { UIButton.touch(:symbol) }.must_raise(RuntimeError)
metadata CHANGED
@@ -1,19 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calios-uikit-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jani Jegoroff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-20 00:00:00.000000000 Z
11
+ date: 2014-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: calabash-cucumber
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.9'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
22
  version: 0.9.169
@@ -21,6 +24,9 @@ dependencies:
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.9'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
32
  version: 0.9.169
@@ -80,6 +86,20 @@ dependencies:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
88
  version: '1.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.26'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.26'
83
103
  description: Calabash-ios UIKit extension provides convenient metaclasses for Calabash
84
104
  usage.
85
105
  email: