Rename checks and unchecks to check and uncheck
This commit is contained in:
parent
5e531f1a0a
commit
ea193e15d2
|
@ -36,23 +36,23 @@ module Webrat
|
|||
# as checked, so that the value will be submitted with the form.
|
||||
#
|
||||
# Example:
|
||||
# checks 'Remember Me'
|
||||
def checks(id_or_name_or_label)
|
||||
# check 'Remember Me'
|
||||
def check(id_or_name_or_label)
|
||||
find_field(id_or_name_or_label, CheckboxField).check
|
||||
end
|
||||
|
||||
alias_method :check, :checks
|
||||
alias_method :checks, :check
|
||||
|
||||
# Verifies that an input checkbox exists on the current page and marks it
|
||||
# as unchecked, so that the value will not be submitted with the form.
|
||||
#
|
||||
# Example:
|
||||
# unchecks 'Remember Me'
|
||||
def unchecks(id_or_name_or_label)
|
||||
# uncheck 'Remember Me'
|
||||
def uncheck(id_or_name_or_label)
|
||||
find_field(id_or_name_or_label, CheckboxField).uncheck
|
||||
end
|
||||
|
||||
alias_method :uncheck, :unchecks
|
||||
alias_method :unchecks, :uncheck
|
||||
|
||||
# Verifies that an input radio button exists on the current page and marks it
|
||||
# as checked, so that the value will be submitted with the form.
|
||||
|
|
|
@ -91,10 +91,12 @@ module Webrat
|
|||
@selenium.click("webrat=#{label_text}")
|
||||
end
|
||||
|
||||
def checks(label_text)
|
||||
def check(label_text)
|
||||
@selenium.check("webrat=#{label_text}")
|
||||
end
|
||||
|
||||
alias_method :checks, :check
|
||||
|
||||
def is_ordered(*args)
|
||||
@selenium.is_ordered(*args)
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
||||
|
||||
describe "checks" do
|
||||
describe "check" do
|
||||
before do
|
||||
@session = Webrat::TestSession.new
|
||||
end
|
||||
|
@ -11,7 +11,7 @@ describe "checks" do
|
|||
</form>
|
||||
EOS
|
||||
|
||||
lambda { @session.checks "remember_me" }.should raise_error
|
||||
lambda { @session.check "remember_me" }.should raise_error
|
||||
end
|
||||
|
||||
it "should fail if input is not a checkbox" do
|
||||
|
@ -21,7 +21,7 @@ describe "checks" do
|
|||
</form>
|
||||
EOS
|
||||
|
||||
lambda { @session.checks "remember_me" }.should raise_error
|
||||
lambda { @session.check "remember_me" }.should raise_error
|
||||
end
|
||||
|
||||
it "should check rails style checkboxes" do
|
||||
|
@ -34,7 +34,7 @@ describe "checks" do
|
|||
</form>
|
||||
EOS
|
||||
@session.should_receive(:get).with("/login", "user" => {"tos" => "1"})
|
||||
@session.checks "TOS"
|
||||
@session.check "TOS"
|
||||
@session.clicks_button
|
||||
end
|
||||
|
||||
|
@ -46,7 +46,7 @@ describe "checks" do
|
|||
</form>
|
||||
EOS
|
||||
@session.should_receive(:post).with("/login", "remember_me" => "on")
|
||||
@session.checks "remember_me"
|
||||
@session.check "remember_me"
|
||||
@session.clicks_button
|
||||
end
|
||||
|
||||
|
@ -57,7 +57,7 @@ describe "checks" do
|
|||
<input type="submit" />
|
||||
</form>
|
||||
EOS
|
||||
lambda { @session.checks "remember_me" }.should raise_error
|
||||
lambda { @session.check "remember_me" }.should raise_error
|
||||
end
|
||||
|
||||
it "should result in a custom value being posted" do
|
||||
|
@ -68,12 +68,12 @@ describe "checks" do
|
|||
</form>
|
||||
EOS
|
||||
@session.should_receive(:post).with("/login", "remember_me" => "yes")
|
||||
@session.checks "remember_me"
|
||||
@session.check "remember_me"
|
||||
@session.clicks_button
|
||||
end
|
||||
end
|
||||
|
||||
describe "unchecks" do
|
||||
describe "uncheck" do
|
||||
before do
|
||||
@session = Webrat::TestSession.new
|
||||
end
|
||||
|
@ -84,7 +84,7 @@ describe "unchecks" do
|
|||
</form>
|
||||
EOS
|
||||
|
||||
lambda { @session.unchecks "remember_me" }.should raise_error
|
||||
lambda { @session.uncheck "remember_me" }.should raise_error
|
||||
end
|
||||
|
||||
it "should fail if input is not a checkbox" do
|
||||
|
@ -94,7 +94,7 @@ describe "unchecks" do
|
|||
</form>
|
||||
EOS
|
||||
|
||||
lambda { @session.unchecks "remember_me" }.should raise_error
|
||||
lambda { @session.uncheck "remember_me" }.should raise_error
|
||||
end
|
||||
|
||||
it "should fail if the checkbox is disabled" do
|
||||
|
@ -104,7 +104,7 @@ describe "unchecks" do
|
|||
<input type="submit" />
|
||||
</form>
|
||||
EOS
|
||||
lambda { @session.unchecks "remember_me" }.should raise_error
|
||||
lambda { @session.uncheck "remember_me" }.should raise_error
|
||||
end
|
||||
|
||||
it "should uncheck rails style checkboxes" do
|
||||
|
@ -117,8 +117,8 @@ describe "unchecks" do
|
|||
</form>
|
||||
EOS
|
||||
@session.should_receive(:get).with("/login", "user" => {"tos" => "0"})
|
||||
@session.checks "TOS"
|
||||
@session.unchecks "TOS"
|
||||
@session.check "TOS"
|
||||
@session.uncheck "TOS"
|
||||
@session.clicks_button
|
||||
end
|
||||
|
||||
|
@ -130,7 +130,7 @@ describe "unchecks" do
|
|||
</form>
|
||||
EOS
|
||||
@session.should_receive(:post).with("/login", {})
|
||||
@session.unchecks "remember_me"
|
||||
@session.uncheck "remember_me"
|
||||
@session.clicks_button
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue