rspectacular 0.27.0 → 0.28.0

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: 63f7625baa9bb8302148f4d20f0e0ef9c0a77845
4
- data.tar.gz: ed8ed841a6757b97011b73344d428215a0ff690f
3
+ metadata.gz: 0a326a51bf1583e4aecba367c22f01645937e156
4
+ data.tar.gz: bdd2c5ea9cbf0d8054f74eb39e9e9eb9ba58be85
5
5
  SHA512:
6
- metadata.gz: 10272de49c24acf6f7d9de0e5fdee24b805574eba9ec1235c31dc7cc43bcb329165676ccd33bcc45761d160ac37b6cbce28153905afd16561167630e32ff2b6a
7
- data.tar.gz: 19885d09c6de57460efb2483d81ddae969328f01aa24f41b05b2b6551ca46e329283e2db162491af95f5ed265d9f79cb2b876daef5d9db19468cf4381698cf55
6
+ metadata.gz: 441cb7fa2b3243d268d895cf489c918c37c1bdfd30d67a95092e41d5f114eea8d0f89bccb6590e182f377a2592b0464cc54ce1489001f5e0672b552cef8ae31f
7
+ data.tar.gz: b9e7b2b98e0758d442252bd450137e6cbd6b54d00b6d4ed8c9100fb80a08c2fffe999ddf3e0ae4e0c4d5c3ac8cdfde6c86d00fa16692eb8a414c878cb4cd647b
@@ -13,14 +13,16 @@ def idsf(*args)
13
13
  end
14
14
 
15
15
  def sf(*args)
16
- string = args[0]
17
- selector = RSpectacular::Selectors.find { |regex, selector| string.match regex }[1]
16
+ selector_description = args[0]
17
+ selector_entry = RSpectacular.selectors.find { |regex, selector| selector_description.match regex }
18
18
 
19
- if selector.present?
20
- if selector.respond_to? :call
21
- selector.call(*args)
22
- else
23
- selector
24
- end
19
+ fail "Cannot find selector for '#{selector_description}'. Please add it to the list of selectors." if selector_entry.nil?
20
+
21
+ selector = selector_entry[1]
22
+
23
+ if selector.respond_to? :call
24
+ selector.call(*args)
25
+ else
26
+ selector
25
27
  end
26
28
  end
@@ -1,51 +1,51 @@
1
1
  module RSpectacular
2
- Selectors = {}
3
-
4
- Selectors.merge!(
5
- /the Facebook application/ => lambda do
6
- frame_element = find 'html#facebook div#pagelet_app_runner iframe'
7
- frame_element[:id]
8
- end,
9
-
10
- /the flash(.*)/ => lambda do |*args|
11
- flash_type = args[0][/the flash(.*)/, 1]
12
- flash_type_class = flash_type.strip
13
- flash_type_class = flash_type_class.empty? ? '' : ".#{flash_type_class}"
14
-
15
- ".flash#{flash_type_class} p"
16
- end,
17
-
18
- ###
19
- # Facebook
20
- #
21
- /the Facebook login form/ => 'html#facebook form#login_form',
22
- /the Facebook page timeline nav bar/ => 'html#facebook #fbTimelineNavTopRow',
23
- /the Facebook account menu/ => '#navAccountLink',
24
-
25
- ###
26
- # PayPal
27
- #
28
- /the "Pay with PayPal" button/ => 'input[alt="Check out with PayPal"]',
29
-
30
- ###
31
- # Forms
32
- #
33
- /the errors for (.*)/ => lambda { "#{sf $1}+div.error" },
34
-
35
- ###
36
- # Windows
37
- #
38
- /the most recently opened window/ => lambda { page.driver.browser.window_handles.last },
39
- /the alert dialog/ => lambda { page.driver.browser.switch_to.alert },
40
-
41
- ###
42
- # Date Picker Buttons
43
- #
44
- /the date picker button for today/ => '.ui-datepicker-today',
45
-
46
- ###
47
- # Model Links
48
- #
49
- /the (.*) button for/ => lambda { "##{$1.gsub(/ /, '_')}_#{args[0].class.name.underscore}_#{args[0].id}_link" }
50
- )
2
+ def self.default_selectors
3
+ {
4
+ /the Facebook application/ => lambda do
5
+ frame_element = find 'html#facebook div#pagelet_app_runner iframe'
6
+ frame_element[:id]
7
+ end,
8
+
9
+ /the flash(.*)/ => lambda do |*args|
10
+ flash_type = args[0][/the flash(.*)/, 1]
11
+ flash_type_class = flash_type.strip
12
+ flash_type_class = flash_type_class.empty? ? '' : ".#{flash_type_class}"
13
+
14
+ ".flash#{flash_type_class} p"
15
+ end,
16
+
17
+ ###
18
+ # Facebook
19
+ #
20
+ /the Facebook login form/ => 'html#facebook form#login_form',
21
+ /the Facebook page timeline nav bar/ => 'html#facebook #fbTimelineNavTopRow',
22
+ /the Facebook account menu/ => '#navAccountLink',
23
+
24
+ ###
25
+ # PayPal
26
+ #
27
+ /the "Pay with PayPal" button/ => 'input[alt="Check out with PayPal"]',
28
+
29
+ ###
30
+ # Forms
31
+ #
32
+ /the errors for (.*)/ => lambda { "#{sf $1}+div.error" },
33
+
34
+ ###
35
+ # Windows
36
+ #
37
+ /the most recently opened window/ => lambda { page.driver.browser.window_handles.last },
38
+ /the alert dialog/ => lambda { page.driver.browser.switch_to.alert },
39
+
40
+ ###
41
+ # Date Picker Buttons
42
+ #
43
+ /the date picker button for today/ => '.ui-datepicker-today',
44
+
45
+ ###
46
+ # Model Links
47
+ #
48
+ /the (.*) button for/ => lambda { "##{$1.gsub(/ /, '_')}_#{args[0].class.name.underscore}_#{args[0].id}_link" }
49
+ }
50
+ end
51
51
  end
@@ -1,3 +1,3 @@
1
1
  module RSpectacular
2
- VERSION = '0.27.0'
2
+ VERSION = '0.28.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspectacular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jfelchner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-17 00:00:00.000000000 Z
11
+ date: 2014-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec