watirsome 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/watirsome/accessors.rb +1 -1
- data/lib/watirsome/version.rb +1 -1
- data/lib/watirsome.rb +4 -4
- data/spec/lib/watirsome/accessors_spec.rb +1 -1
- data/spec/support/page.rb +1 -1
- data/spec/support/shared_examples/click_accessor.rb +2 -1
- data/spec/support/shared_examples/element_accessor.rb +2 -1
- data/spec/support/shared_examples/read_accessor.rb +2 -1
- data/spec/support/shared_examples/select_accessor.rb +2 -1
- data/spec/support/shared_examples/set_accessor.rb +2 -1
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/lib/watirsome/accessors.rb
CHANGED
@@ -216,7 +216,7 @@ module Watirsome
|
|
216
216
|
@browser.send(method, *watir_args)
|
217
217
|
else
|
218
218
|
plural = Watirsome.plural?(method)
|
219
|
-
method =
|
219
|
+
method = Watirsome.pluralize(method) unless plural
|
220
220
|
elements = @browser.send(method, *watir_args)
|
221
221
|
custom_args.first.each { |k, v| elements.to_a.select! { |e| e.send(:"#{k}?") == v } }
|
222
222
|
plural ? elements : elements.first
|
data/lib/watirsome/version.rb
CHANGED
data/lib/watirsome.rb
CHANGED
@@ -123,8 +123,8 @@ module Watirsome
|
|
123
123
|
# Returns true if method is element accessor in plural form.
|
124
124
|
#
|
125
125
|
# @example
|
126
|
-
# Watirsome
|
127
|
-
# Watirsome
|
126
|
+
# Watirsome.plural? :div #=> false
|
127
|
+
# Watirsome.plural? :divs #=> true
|
128
128
|
#
|
129
129
|
# @param [Symbol, String] method
|
130
130
|
# @return [Boolean]
|
@@ -142,8 +142,8 @@ module Watirsome
|
|
142
142
|
# Pluralizes element.
|
143
143
|
#
|
144
144
|
# @example
|
145
|
-
# Watirsome
|
146
|
-
# Watirsome
|
145
|
+
# Watirsome.pluralize :div #=> :divs
|
146
|
+
# Watirsome.pluralize :checkbox #=> :checkboxes
|
147
147
|
#
|
148
148
|
# @param [Symbol, String] method
|
149
149
|
# @return [Symbol]
|
@@ -7,6 +7,6 @@ describe Watirsome::Accessors do
|
|
7
7
|
it_defines :element_accessor, %w(div a text_field select_list)
|
8
8
|
it_defines :read_accessor, %w(div text_field select_list)
|
9
9
|
it_defines :click_accessor, %w(a)
|
10
|
-
it_defines :set_accessor, %w(text_field)
|
10
|
+
it_defines :set_accessor, %w(text_field checkbox)
|
11
11
|
it_defines :select_accessor, %w(select_list)
|
12
12
|
end
|
data/spec/support/page.rb
CHANGED
@@ -25,7 +25,8 @@ shared_examples_for :click_accessor do |tags|
|
|
25
25
|
|
26
26
|
it 'clicks element with custom locator' do
|
27
27
|
element2 = stub('element', visible?: false)
|
28
|
-
|
28
|
+
plural = Watirsome.pluralize(tag)
|
29
|
+
watir.should_receive(plural).with(id: tag, class: tag).and_return([element, element2])
|
29
30
|
element.should_receive(:click).with(any_args)
|
30
31
|
accessor(tag, 4)
|
31
32
|
end
|
@@ -22,7 +22,8 @@ shared_examples_for :element_accessor do |tags|
|
|
22
22
|
|
23
23
|
it 'finds element with custom locator' do
|
24
24
|
element2 = stub('element')
|
25
|
-
|
25
|
+
plural = Watirsome.pluralize(tag)
|
26
|
+
watir.should_receive(plural).with(id: tag, class: tag).and_return([element, element2])
|
26
27
|
element.should_receive(:visible?).with(no_args).and_return(true)
|
27
28
|
element2.should_receive(:visible?).with(no_args).and_return(false)
|
28
29
|
accessor(tag, 4).should == element
|
@@ -40,7 +40,8 @@ shared_examples_for :read_accessor do |tags|
|
|
40
40
|
|
41
41
|
it 'gets text from element with custom locator' do
|
42
42
|
element2 = stub('element', visible?: false)
|
43
|
-
|
43
|
+
plural = Watirsome.pluralize(tag)
|
44
|
+
watir.should_receive(plural).with(id: tag, class: tag).and_return([element, element2])
|
44
45
|
read_expectation(tag)
|
45
46
|
accessor(tag, 4).should == 'text'
|
46
47
|
end
|
@@ -25,7 +25,8 @@ shared_examples_for :select_accessor do |tags|
|
|
25
25
|
|
26
26
|
it 'selects option for element with custom locator' do
|
27
27
|
element2 = stub('element', visible?: false)
|
28
|
-
|
28
|
+
plural = Watirsome.pluralize(tag)
|
29
|
+
watir.should_receive(plural).with(id: tag, class: tag).and_return([element, element2])
|
29
30
|
element.should_receive(:select).with('value')
|
30
31
|
accessor(tag, 4, 'value')
|
31
32
|
end
|
@@ -25,7 +25,8 @@ shared_examples_for :set_accessor do |tags|
|
|
25
25
|
|
26
26
|
it 'sets value on element with custom locator' do
|
27
27
|
element2 = stub('element', visible?: false)
|
28
|
-
|
28
|
+
plural = Watirsome.pluralize(tag)
|
29
|
+
watir.should_receive(plural).with(id: tag, class: tag).and_return([element, element2])
|
29
30
|
element.should_receive(:set).with('value')
|
30
31
|
accessor(tag, 4, 'value')
|
31
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watirsome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -151,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
151
|
version: '0'
|
152
152
|
segments:
|
153
153
|
- 0
|
154
|
-
hash:
|
154
|
+
hash: 3290082201192832262
|
155
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
156
|
none: false
|
157
157
|
requirements:
|
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
160
|
version: '0'
|
161
161
|
segments:
|
162
162
|
- 0
|
163
|
-
hash:
|
163
|
+
hash: 3290082201192832262
|
164
164
|
requirements: []
|
165
165
|
rubyforge_project:
|
166
166
|
rubygems_version: 1.8.23
|