Fix the rack driver to favour option's value attributes over their content.
This commit is contained in:
parent
c67dceb537
commit
55476db4bd
15
Gemfile
15
Gemfile
|
@ -1,3 +1,14 @@
|
||||||
source :gemcutter
|
source 'http://gemcutter.org'
|
||||||
|
|
||||||
gemspec
|
gem 'rails', '3.0.0'
|
||||||
|
|
||||||
|
group :development, :test do
|
||||||
|
gem 'nokogiri'
|
||||||
|
gem 'xpath'
|
||||||
|
gem 'sinatra'
|
||||||
|
gem 'culerity'
|
||||||
|
gem 'selenium-webdriver'
|
||||||
|
gem 'launchy'
|
||||||
|
gem 'rspec-rails', '>= 2.0.0.beta.20'
|
||||||
|
gem 'cucumber-rails'
|
||||||
|
end
|
||||||
|
|
117
Gemfile.lock
117
Gemfile.lock
|
@ -1,37 +1,92 @@
|
||||||
PATH
|
|
||||||
remote: .
|
|
||||||
specs:
|
|
||||||
capybara (0.3.9)
|
|
||||||
celerity (>= 0.7.9)
|
|
||||||
culerity (>= 0.2.4)
|
|
||||||
mime-types (>= 1.16)
|
|
||||||
nokogiri (>= 1.3.3)
|
|
||||||
rack (>= 1.0.0)
|
|
||||||
rack-test (>= 0.5.4)
|
|
||||||
selenium-webdriver (>= 0.0.27)
|
|
||||||
xpath (>= 0.1.0)
|
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://gemcutter.org/
|
||||||
specs:
|
specs:
|
||||||
celerity (0.8.2)
|
abstract (1.0.0)
|
||||||
|
actionmailer (3.0.0)
|
||||||
|
actionpack (= 3.0.0)
|
||||||
|
mail (~> 2.2.5)
|
||||||
|
actionpack (3.0.0)
|
||||||
|
activemodel (= 3.0.0)
|
||||||
|
activesupport (= 3.0.0)
|
||||||
|
builder (~> 2.1.2)
|
||||||
|
erubis (~> 2.6.6)
|
||||||
|
i18n (~> 0.4.1)
|
||||||
|
rack (~> 1.2.1)
|
||||||
|
rack-mount (~> 0.6.12)
|
||||||
|
rack-test (~> 0.5.4)
|
||||||
|
tzinfo (~> 0.3.23)
|
||||||
|
activemodel (3.0.0)
|
||||||
|
activesupport (= 3.0.0)
|
||||||
|
builder (~> 2.1.2)
|
||||||
|
i18n (~> 0.4.1)
|
||||||
|
activerecord (3.0.0)
|
||||||
|
activemodel (= 3.0.0)
|
||||||
|
activesupport (= 3.0.0)
|
||||||
|
arel (~> 1.0.0)
|
||||||
|
tzinfo (~> 0.3.23)
|
||||||
|
activeresource (3.0.0)
|
||||||
|
activemodel (= 3.0.0)
|
||||||
|
activesupport (= 3.0.0)
|
||||||
|
activesupport (3.0.0)
|
||||||
|
arel (1.0.1)
|
||||||
|
activesupport (~> 3.0.0)
|
||||||
|
builder (2.1.2)
|
||||||
configuration (1.1.0)
|
configuration (1.1.0)
|
||||||
|
cucumber (0.9.2)
|
||||||
|
builder (~> 2.1.2)
|
||||||
|
diff-lcs (~> 1.1.2)
|
||||||
|
gherkin (~> 2.2.5)
|
||||||
|
json (~> 1.4.6)
|
||||||
|
term-ansicolor (~> 1.0.5)
|
||||||
|
cucumber-rails (0.3.2)
|
||||||
|
cucumber (>= 0.8.0)
|
||||||
culerity (0.2.12)
|
culerity (0.2.12)
|
||||||
diff-lcs (1.1.2)
|
diff-lcs (1.1.2)
|
||||||
|
erubis (2.6.6)
|
||||||
|
abstract (>= 1.0.0)
|
||||||
ffi (0.6.3)
|
ffi (0.6.3)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
ffi (0.6.3-java)
|
ffi (0.6.3-java)
|
||||||
|
gherkin (2.2.8)
|
||||||
|
json (~> 1.4.6)
|
||||||
|
term-ansicolor (~> 1.0.5)
|
||||||
|
gherkin (2.2.8-java)
|
||||||
|
json (~> 1.4.6)
|
||||||
|
term-ansicolor (~> 1.0.5)
|
||||||
|
i18n (0.4.1)
|
||||||
|
json (1.4.6)
|
||||||
|
json (1.4.6-java)
|
||||||
json_pure (1.4.6)
|
json_pure (1.4.6)
|
||||||
launchy (0.3.7)
|
launchy (0.3.7)
|
||||||
configuration (>= 0.0.5)
|
configuration (>= 0.0.5)
|
||||||
rake (>= 0.8.1)
|
rake (>= 0.8.1)
|
||||||
|
mail (2.2.6.1)
|
||||||
|
activesupport (>= 2.3.6)
|
||||||
|
mime-types
|
||||||
|
treetop (>= 1.4.5)
|
||||||
mime-types (1.16)
|
mime-types (1.16)
|
||||||
nokogiri (1.4.3.1)
|
nokogiri (1.4.3.1)
|
||||||
nokogiri (1.4.3.1-java)
|
nokogiri (1.4.3.1-java)
|
||||||
weakling (>= 0.0.3)
|
weakling (>= 0.0.3)
|
||||||
|
polyglot (0.3.1)
|
||||||
rack (1.2.1)
|
rack (1.2.1)
|
||||||
rack-test (0.5.4)
|
rack-mount (0.6.13)
|
||||||
|
rack (>= 1.0.0)
|
||||||
|
rack-test (0.5.6)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
|
rails (3.0.0)
|
||||||
|
actionmailer (= 3.0.0)
|
||||||
|
actionpack (= 3.0.0)
|
||||||
|
activerecord (= 3.0.0)
|
||||||
|
activeresource (= 3.0.0)
|
||||||
|
activesupport (= 3.0.0)
|
||||||
|
bundler (~> 1.0.0)
|
||||||
|
railties (= 3.0.0)
|
||||||
|
railties (3.0.0)
|
||||||
|
actionpack (= 3.0.0)
|
||||||
|
activesupport (= 3.0.0)
|
||||||
|
rake (>= 0.8.4)
|
||||||
|
thor (~> 0.14.0)
|
||||||
rake (0.8.7)
|
rake (0.8.7)
|
||||||
rspec (2.0.0.beta.22)
|
rspec (2.0.0.beta.22)
|
||||||
rspec-core (= 2.0.0.beta.22)
|
rspec-core (= 2.0.0.beta.22)
|
||||||
|
@ -43,6 +98,8 @@ GEM
|
||||||
rspec-mocks (2.0.0.beta.22)
|
rspec-mocks (2.0.0.beta.22)
|
||||||
rspec-core (= 2.0.0.beta.22)
|
rspec-core (= 2.0.0.beta.22)
|
||||||
rspec-expectations (= 2.0.0.beta.22)
|
rspec-expectations (= 2.0.0.beta.22)
|
||||||
|
rspec-rails (2.0.0.beta.22)
|
||||||
|
rspec (= 2.0.0.beta.22)
|
||||||
rubyzip (0.9.4)
|
rubyzip (0.9.4)
|
||||||
selenium-webdriver (0.0.28)
|
selenium-webdriver (0.0.28)
|
||||||
ffi (>= 0.6.1)
|
ffi (>= 0.6.1)
|
||||||
|
@ -50,25 +107,25 @@ GEM
|
||||||
rubyzip
|
rubyzip
|
||||||
sinatra (1.0)
|
sinatra (1.0)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
|
term-ansicolor (1.0.5)
|
||||||
|
thor (0.14.3)
|
||||||
|
treetop (1.4.8)
|
||||||
|
polyglot (>= 0.3.1)
|
||||||
|
tzinfo (0.3.23)
|
||||||
weakling (0.0.4-java)
|
weakling (0.0.4-java)
|
||||||
xpath (0.1.0)
|
xpath (0.1.0)
|
||||||
yard (0.6.1)
|
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
java
|
java
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
capybara!
|
cucumber-rails
|
||||||
celerity (>= 0.7.9)
|
culerity
|
||||||
culerity (>= 0.2.4)
|
launchy
|
||||||
launchy (>= 0.3.5)
|
nokogiri
|
||||||
mime-types (>= 1.16)
|
rails (= 3.0.0)
|
||||||
nokogiri (>= 1.3.3)
|
rspec-rails (>= 2.0.0.beta.20)
|
||||||
rack (>= 1.0.0)
|
selenium-webdriver
|
||||||
rack-test (>= 0.5.4)
|
sinatra
|
||||||
rspec (>= 2.0.0.beta.22)
|
xpath
|
||||||
selenium-webdriver (>= 0.0.27)
|
|
||||||
sinatra (>= 0.9.4)
|
|
||||||
xpath (>= 0.1.0)
|
|
||||||
yard (>= 0.5.8)
|
|
||||||
|
|
|
@ -14,10 +14,10 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
|
||||||
case
|
case
|
||||||
when 'select' == tag_name && 'value' == attr_name
|
when 'select' == tag_name && 'value' == attr_name
|
||||||
if native['multiple'] == 'multiple'
|
if native['multiple'] == 'multiple'
|
||||||
native.xpath(".//option[@selected='selected']").map { |option| option.content }
|
native.xpath(".//option[@selected='selected']").map { |option| option[:value] || option.content }
|
||||||
else
|
else
|
||||||
option = native.xpath(".//option[@selected='selected']").first || native.xpath(".//option").first
|
option = native.xpath(".//option[@selected='selected']").first || native.xpath(".//option").first
|
||||||
option.content if option
|
option[:value] || option.content if option
|
||||||
end
|
end
|
||||||
when 'input' == tag_name && 'checkbox' == type && 'checked' == attr_name
|
when 'input' == tag_name && 'checkbox' == type && 'checked' == attr_name
|
||||||
native[attr_name] == 'checked' ? true : false
|
native[attr_name] == 'checked' ? true : false
|
||||||
|
|
|
@ -13,6 +13,10 @@ shared_examples_for "select" do
|
||||||
@session.find_field('Title').value.should == 'Miss'
|
@session.find_field('Title').value.should == 'Miss'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should return the value attribute rather than content if present" do
|
||||||
|
@session.find_field('Locale').value.should == 'en'
|
||||||
|
end
|
||||||
|
|
||||||
it "should select an option from a select box by id" do
|
it "should select an option from a select box by id" do
|
||||||
@session.select("Finish", :from => 'form_locale')
|
@session.select("Finish", :from => 'form_locale')
|
||||||
@session.click_button('awesome')
|
@session.click_button('awesome')
|
||||||
|
@ -92,6 +96,10 @@ shared_examples_for "select" do
|
||||||
@session.click_button('awesome')
|
@session.click_button('awesome')
|
||||||
extract_results(@session)['languages'].should include('Ruby', 'Javascript')
|
extract_results(@session)['languages'].should include('Ruby', 'Javascript')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should return value attribute rather than content if present" do
|
||||||
|
@session.find_field('Underwear').value.should include('thermal')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -155,6 +155,7 @@
|
||||||
<option selected="selected">Briefs</option>
|
<option selected="selected">Briefs</option>
|
||||||
<option selected="selected">Commando</option>
|
<option selected="selected">Commando</option>
|
||||||
<option selected="selected">Frenchman's Pantalons</option>
|
<option selected="selected">Frenchman's Pantalons</option>
|
||||||
|
<option selected="selected" value="thermal">Long Johns</option>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue