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 CHANGED
@@ -1,3 +1,7 @@
1
+ #### v0.1.2
2
+
3
+ * Fix for checkboxes in previous version hasn't actually resolved issue. Now fixes
4
+
1
5
  #### v0.1.1
2
6
 
3
7
  * Fixed problem when plural form of `checkbox` was `checkboxs` instead of `checkboxes`
@@ -216,7 +216,7 @@ module Watirsome
216
216
  @browser.send(method, *watir_args)
217
217
  else
218
218
  plural = Watirsome.plural?(method)
219
- method = :"#{method}s" unless plural
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
@@ -1,3 +1,3 @@
1
1
  module Watirsome
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end # Watirsome
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::Accessors.plural? :div #=> false
127
- # Watirsome::Accessors.plural? :divs #=> true
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::Accessors.pluralize :div #=> :divs
146
- # Watirsome::Accessors.pluralize :checkbox #=> :checkboxes
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
@@ -30,7 +30,7 @@ class Page
30
30
  @initialized = true
31
31
  end
32
32
 
33
- %w(div a text_field select_list).each do |tag|
33
+ %w(div a text_field checkbox select_list).each do |tag|
34
34
  send tag, :"#{tag}1"
35
35
  send tag, :"#{tag}2", id: tag
36
36
  send tag, :"#{tag}3", id: tag, class: /#{tag}/
@@ -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
- watir.should_receive(:"#{tag}s").with(id: tag, class: tag).and_return([element, element2])
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
- watir.should_receive(:"#{tag}s").with(id: tag, class: tag).and_return([element, element2])
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
- watir.should_receive(:"#{tag}s").with(id: tag, class: tag).and_return([element, element2])
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
- watir.should_receive(:"#{tag}s").with(id: tag, class: tag).and_return([element, element2])
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
- watir.should_receive(:"#{tag}s").with(id: tag, class: tag).and_return([element, element2])
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.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: -4498272720920945447
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: -4498272720920945447
163
+ hash: 3290082201192832262
164
164
  requirements: []
165
165
  rubyforge_project:
166
166
  rubygems_version: 1.8.23