capybara-select2 0.0.3 → 0.0.4
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.
- data/lib/capybara-select2.rb +4 -5
- data/lib/capybara-select2/version.rb +1 -1
- metadata +3 -2
data/lib/capybara-select2.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
require "capybara-select2/version"
|
2
|
+
require 'rspec/core'
|
2
3
|
|
3
4
|
module Capybara
|
4
5
|
module Select2
|
5
|
-
def select2(value, options={})
|
6
|
+
def select2(value, options = {})
|
6
7
|
raise "Must pass a hash containing 'from'" if not options.is_a?(Hash) or not options.has_key?(:from)
|
7
8
|
select_name = options[:from]
|
8
9
|
|
9
|
-
select2_container=find("label:contains(\"#{select_name}\")").find(:xpath, '..').find(".select2-container")
|
10
|
-
PP.pp(select2_container)
|
11
10
|
|
11
|
+
select2_container=find("label", text: select_name).find(:xpath, '..').find(".select2-container")
|
12
12
|
select2_container.find(".select2-choice").click
|
13
13
|
|
14
|
-
find(".select2-drop li:
|
15
|
-
|
14
|
+
find(".select2-drop li", text: value).click
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-select2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-04-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -84,3 +84,4 @@ signing_key:
|
|
84
84
|
specification_version: 3
|
85
85
|
summary: ''
|
86
86
|
test_files: []
|
87
|
+
has_rdoc:
|