capybara-widgets 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6098133608959ad7f47a27320f444af1f12d0c36
4
- data.tar.gz: 4ef8e92718c13b567940a5d19fb8205b1b5e75a7
3
+ metadata.gz: 37f25d932ff565ce8c892a8f67ef212c61edfd2f
4
+ data.tar.gz: 0154bf14ea9f129ef817af426097d16d15dec169
5
5
  SHA512:
6
- metadata.gz: 9d5e72a72778f15840641a164f0939a035305770101565dbedd8ce6a7bf9929168b0f92ea7669baaffb65871e95e80b3e678adbd57f63a3e7c5b5f7513298e92
7
- data.tar.gz: 68736acf920107ce9229b003e5a286604118181cbef729917559b0f2e8eee5bc6b93e69f9bd44990577f33b7d88573f684850ab5d6343e26330ad24c35664a3d
6
+ metadata.gz: d823d6063bd84f1cf2e955a931904e3a98f662f4de5d581fcd80f1da779888f7f2538cbd8d818545a6c3dd6b66a6cf4ceba6a85d24344c83a78db15ba0bfbb46
7
+ data.tar.gz: 1f568992b156b08d190b2dd6dcf6e5eab5fabb3f382e81e22673b5d0d34c4bfb7af946a876a4a72825065c44f7c13cfb48d7c8e02f6e2546729defc2bda4a1f7
@@ -5,6 +5,9 @@ module Capybara
5
5
  raise "#{klass.name} is not a subclass of Widget" unless klass < Capybara::Widgets::Widget
6
6
  yield klass.new
7
7
  end
8
+
9
+ alias_method :on_page, :within_widget
10
+ alias_method :within_page, :within_widget
8
11
  end
9
12
  end
10
- end
13
+ end
@@ -11,6 +11,7 @@ module Capybara
11
11
 
12
12
  class_attribute :path
13
13
  class_attribute :path_matcher
14
+ class_attribute :url_matcher
14
15
 
15
16
  def self.inherited(subclass)
16
17
  PageCollection.instance.registry << subclass
@@ -33,9 +34,14 @@ module Capybara
33
34
 
34
35
  def opened?
35
36
  eventually do
36
- result = self.path_matcher? ?
37
- current_path =~ self.path_matcher :
38
- current_path =~ %r{#{Regexp.quote(self.path)}}
37
+ result = if self.path_matcher?
38
+ current_path =~ self.path_matcher
39
+ elsif self.url_matcher?
40
+ current_url =~ self.url_matcher
41
+ else
42
+ self.path?
43
+ current_path =~ %r{#{Regexp.quote(self.path)}}
44
+ end
39
45
  raise "#{self.class.name} is not opened" unless result
40
46
  result
41
47
  end
@@ -44,6 +44,14 @@ When(/^I open "([^"]*)" from a "([^"]*)"$/) do |action_param, widget_path|
44
44
  target_widget.open!(action_param)
45
45
  end
46
46
 
47
+ # Example:
48
+ # I select "My first account" in "Account chooser"
49
+ # is mapped to:
50
+ # AccountChooser.new.select!("My first account")
51
+ When(/^I select "([^"]*)" (?:in|on)(?: an?)? "([^"]*)"$/) do |action_param, widget_path|
52
+ target_widget = resolve_widget(widget_path)
53
+ target_widget.select!(action_param)
54
+ end
47
55
 
48
56
  And(/^I should see the following "([^"]*)" in a "([^"]*)"$/) do |field_name, widget_path, table|
49
57
  expected_values = table.raw.flatten
@@ -90,4 +98,4 @@ And(/^the "([^"]*)" should( not)? be "([^"]*)" in a "([^"]*)"$/) do |field_name,
90
98
  end
91
99
  end
92
100
  end
93
- end
101
+ end
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Widgets
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-widgets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitalii Grygoruk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-19 00:00:00.000000000 Z
11
+ date: 2015-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler