Rename chooses to choose
This commit is contained in:
parent
24ac5d3fb7
commit
c5bf4f30f6
@ -58,12 +58,12 @@ module Webrat
|
|||||||
# as checked, so that the value will be submitted with the form.
|
# as checked, so that the value will be submitted with the form.
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# chooses 'First Option'
|
# choose 'First Option'
|
||||||
def chooses(label)
|
def choose(label)
|
||||||
find_field(label, RadioField).choose
|
find_field(label, RadioField).choose
|
||||||
end
|
end
|
||||||
|
|
||||||
alias_method :choose, :chooses
|
alias_method :chooses, :choose
|
||||||
|
|
||||||
# Verifies that a an option element exists on the current page with the specified
|
# Verifies that a an option element exists on the current page with the specified
|
||||||
# text. You can optionally restrict the search to a specific select list by
|
# text. You can optionally restrict the search to a specific select list by
|
||||||
|
@ -90,10 +90,12 @@ module Webrat
|
|||||||
@selenium.select(select_locator, option_text)
|
@selenium.select(select_locator, option_text)
|
||||||
end
|
end
|
||||||
|
|
||||||
def chooses(label_text)
|
def choose(label_text)
|
||||||
@selenium.click("webrat=#{label_text}")
|
@selenium.click("webrat=#{label_text}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :chooses, :choose
|
||||||
|
|
||||||
def check(label_text)
|
def check(label_text)
|
||||||
@selenium.check("webrat=#{label_text}")
|
@selenium.check("webrat=#{label_text}")
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
||||||
|
|
||||||
describe "chooses" do
|
describe "choose" do
|
||||||
before do
|
before do
|
||||||
@session = Webrat::TestSession.new
|
@session = Webrat::TestSession.new
|
||||||
end
|
end
|
||||||
@ -11,7 +11,7 @@ describe "chooses" do
|
|||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
lambda { @session.chooses "first option" }.should raise_error
|
lambda { @session.choose "first option" }.should raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should fail if input is not a radio button" do
|
it "should fail if input is not a radio button" do
|
||||||
@ -21,7 +21,7 @@ describe "chooses" do
|
|||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
lambda { @session.chooses "first_option" }.should raise_error
|
lambda { @session.choose "first_option" }.should raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should check rails style radio buttons" do
|
it "should check rails style radio buttons" do
|
||||||
@ -35,7 +35,7 @@ describe "chooses" do
|
|||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.should_receive(:get).with("/login", "user" => {"gender" => "M"})
|
@session.should_receive(:get).with("/login", "user" => {"gender" => "M"})
|
||||||
@session.chooses "Male"
|
@session.choose "Male"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -50,8 +50,8 @@ describe "chooses" do
|
|||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.should_receive(:get).with("/login", "user" => {"gender" => "M"})
|
@session.should_receive(:get).with("/login", "user" => {"gender" => "M"})
|
||||||
@session.chooses "Female"
|
@session.choose "Female"
|
||||||
@session.chooses "Male"
|
@session.choose "Male"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ describe "chooses" do
|
|||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
lambda { @session.chooses "first_option" }.should raise_error
|
lambda { @session.choose "first_option" }.should raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should result in the value on being posted if not specified" do
|
it "should result in the value on being posted if not specified" do
|
||||||
@ -74,7 +74,7 @@ describe "chooses" do
|
|||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.should_receive(:post).with("/login", "first_option" => "on")
|
@session.should_receive(:post).with("/login", "first_option" => "on")
|
||||||
@session.chooses "first_option"
|
@session.choose "first_option"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ describe "chooses" do
|
|||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.should_receive(:post).with("/login", "user" => {"gender" => "M"})
|
@session.should_receive(:post).with("/login", "user" => {"gender" => "M"})
|
||||||
@session.chooses "Male"
|
@session.choose "Male"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user