capybara_angular_helpers 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capybara_angular_helpers/version.rb +1 -1
- data/lib/capybara_angular_helpers.rb +29 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06664041f0ec7bd33eaa16a2579666b60b709b01
|
4
|
+
data.tar.gz: bdf9f6049ae121780fea04f556e260f8f8823a60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d6f6124e0db154692b2dc6062bba452f566c3382314edf714288130b76e9ea33a2e7244fcaa3a235ca0f7c2aff5bebbe7e1ae603a4b90a04102ba453398b8c7
|
7
|
+
data.tar.gz: a4ce4f6858dcd1c1b5bc173a1c0796ead111309ba3ca1eb8b00c58311c0ddae15e02b35934f1b907ed24527d772413b9659395a173ee9b4629faa5aa21098379
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "capybara_angular_helpers/version"
|
2
|
-
require 'rspec/
|
2
|
+
require 'rspec/rails' unless defined?(RSpec)
|
3
3
|
|
4
4
|
module CapybaraAngularHelpers
|
5
5
|
def ng_fill_in(target, opts)
|
@@ -11,31 +11,42 @@ module CapybaraAngularHelpers
|
|
11
11
|
opts = { with: opts }
|
12
12
|
end
|
13
13
|
|
14
|
-
selector = "input[ng-model='#{target}']"
|
14
|
+
selector = "input[ng-model='#{target}']," +
|
15
|
+
"textarea[ng-model='#{target}']," +
|
16
|
+
"select[ng-model='#{target}']"
|
15
17
|
|
16
18
|
if element_index = opts[:index]
|
17
|
-
|
19
|
+
target_element = all(selector)[element_index]
|
18
20
|
|
19
|
-
if
|
20
|
-
page_element.set(opts[:with])
|
21
|
-
else
|
21
|
+
if !target_element
|
22
22
|
raise "#{target} could not be found"
|
23
23
|
end
|
24
24
|
else
|
25
|
-
find(selector)
|
25
|
+
target_element = find(:css, selector)
|
26
|
+
end
|
27
|
+
|
28
|
+
if target_element.tag_name == 'select'
|
29
|
+
target_element.find(:option, opts[:with]).select_option
|
30
|
+
else
|
31
|
+
target_element.set(opts[:with])
|
26
32
|
end
|
27
33
|
end
|
28
34
|
|
29
|
-
def ng_click_on(target)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
def ng_click_on(target, opts = {})
|
36
|
+
selector = '*[ui-sref],' +
|
37
|
+
'*[ng-click],' +
|
38
|
+
'button'
|
39
|
+
if element_index = opts[:index]
|
40
|
+
target_element = all(selector, text: target)[element_index]
|
41
|
+
|
42
|
+
if !target_element
|
43
|
+
raise "#{target} could not be found"
|
44
|
+
end
|
45
|
+
else
|
46
|
+
target_element = find(:css, selector, text: target)
|
47
|
+
end
|
48
|
+
|
49
|
+
target_element.click
|
39
50
|
end
|
40
51
|
|
41
52
|
def ng_ionic_click_left_nav
|
@@ -57,5 +68,5 @@ module CapybaraAngularHelpers
|
|
57
68
|
end
|
58
69
|
|
59
70
|
RSpec.configure do |config|
|
60
|
-
config.include CapybaraAngularHelpers
|
71
|
+
config.include CapybaraAngularHelpers, type: :feature
|
61
72
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara_angular_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bianco
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|