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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a8cca71f21b81d84f94d0716b211fc5ab0dbbf0
4
- data.tar.gz: f20d9ac8b75f2d9c6b5426445e448bd20702f75b
3
+ metadata.gz: 06664041f0ec7bd33eaa16a2579666b60b709b01
4
+ data.tar.gz: bdf9f6049ae121780fea04f556e260f8f8823a60
5
5
  SHA512:
6
- metadata.gz: 4fc20faacd845c8b424740ecb4553001d200c4b2a1fd1ff48cae29f0ef9e0955f3860a5edcc08cfac50b9db2ef504863ef35cca3976dbc9095ae0cf8c33ebe4b
7
- data.tar.gz: f7683a623a2d56aa0a583d4a78d4b869f198f53992b343f7585fd41891a3d26246458daf35a9dac521406d21c718c184ec7a29d2de4ca6171015324c185df2df
6
+ metadata.gz: 2d6f6124e0db154692b2dc6062bba452f566c3382314edf714288130b76e9ea33a2e7244fcaa3a235ca0f7c2aff5bebbe7e1ae603a4b90a04102ba453398b8c7
7
+ data.tar.gz: a4ce4f6858dcd1c1b5bc173a1c0796ead111309ba3ca1eb8b00c58311c0ddae15e02b35934f1b907ed24527d772413b9659395a173ee9b4629faa5aa21098379
@@ -1,3 +1,3 @@
1
1
  module CapybaraAngularHelpers
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  require "capybara_angular_helpers/version"
2
- require 'rspec/core'
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
- page_element = all(selector)[element_index]
19
+ target_element = all(selector)[element_index]
18
20
 
19
- if page_element
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).set(opts[:with])
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
- begin
31
- find('*[ui-sref]', text: target)
32
- rescue Capybara::ElementNotFound
33
- begin
34
- find('*[ng-click]', text: target)
35
- rescue Capybara::ElementNotFound
36
- find('button', text: target)
37
- end
38
- end.click
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.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-05-27 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec