Switch from Mocha to RSpec mocks
This commit is contained in:
parent
af0ac0933a
commit
2e20267c90
@ -258,8 +258,17 @@ module Webrat
|
|||||||
if @value.nil?
|
if @value.nil?
|
||||||
super
|
super
|
||||||
else
|
else
|
||||||
file = content_type ? ActionController::TestUploadedFile.new(@value, content_type) : ActionController::TestUploadedFile.new(@value)
|
replace_param_value(super, @value, test_uploaded_file)
|
||||||
replace_param_value(super, @value, file)
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def test_uploaded_file
|
||||||
|
if content_type
|
||||||
|
ActionController::TestUploadedFile.new(@value, content_type)
|
||||||
|
else
|
||||||
|
ActionController::TestUploadedFile.new(@value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ describe "attaches_file" do
|
|||||||
@session = Webrat::TestSession.new
|
@session = Webrat::TestSession.new
|
||||||
|
|
||||||
@filename = __FILE__
|
@filename = __FILE__
|
||||||
@uploaded_file = mock
|
@uploaded_file = mock("uploaded file")
|
||||||
ActionController::TestUploadedFile.stubs(:new).returns(@uploaded_file)
|
ActionController::TestUploadedFile.stub!(:new).and_return(@uploaded_file)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should fail if no file field found" do
|
it "should fail if no file field found" do
|
||||||
@ -24,7 +24,7 @@ describe "attaches_file" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/widgets", { "widget" => { "file" => "" } })
|
@session.should_receive(:post).with("/widgets", { "widget" => { "file" => "" } })
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ describe "attaches_file" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/widgets", { "widget" => { "file" => @uploaded_file } })
|
@session.should_receive(:post).with("/widgets", { "widget" => { "file" => @uploaded_file } })
|
||||||
@session.attaches_file "Document", @filename
|
@session.attaches_file "Document", @filename
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -51,7 +51,7 @@ describe "attaches_file" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/widgets", { "widget" => { "files" => [@uploaded_file, @uploaded_file] } })
|
@session.should_receive(:post).with("/widgets", { "widget" => { "files" => [@uploaded_file, @uploaded_file] } })
|
||||||
@session.attaches_file "Document", @filename
|
@session.attaches_file "Document", @filename
|
||||||
@session.attaches_file "Spreadsheet", @filename
|
@session.attaches_file "Spreadsheet", @filename
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
@ -65,7 +65,7 @@ describe "attaches_file" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
ActionController::TestUploadedFile.expects(:new).with(@filename, "image/png").returns(@uploaded_file)
|
ActionController::TestUploadedFile.should_receive(:new).with(@filename, "image/png").any_number_of_times
|
||||||
@session.attaches_file "Picture", @filename, "image/png"
|
@session.attaches_file "Picture", @filename, "image/png"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
@ -33,7 +33,7 @@ describe "checks" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"tos" => "1"})
|
@session.should_receive(:get).with("/login", "user" => {"tos" => "1"})
|
||||||
@session.checks "TOS"
|
@session.checks "TOS"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -45,7 +45,7 @@ describe "checks" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "remember_me" => "on")
|
@session.should_receive(:post).with("/login", "remember_me" => "on")
|
||||||
@session.checks "remember_me"
|
@session.checks "remember_me"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -57,7 +57,7 @@ describe "checks" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "remember_me" => "yes")
|
@session.should_receive(:post).with("/login", "remember_me" => "yes")
|
||||||
@session.checks "remember_me"
|
@session.checks "remember_me"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -96,7 +96,7 @@ describe "unchecks" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"tos" => "0"})
|
@session.should_receive(:get).with("/login", "user" => {"tos" => "0"})
|
||||||
@session.checks "TOS"
|
@session.checks "TOS"
|
||||||
@session.unchecks "TOS"
|
@session.unchecks "TOS"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
@ -109,7 +109,7 @@ describe "unchecks" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", {})
|
@session.should_receive(:post).with("/login", {})
|
||||||
@session.unchecks "remember_me"
|
@session.unchecks "remember_me"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
@ -34,24 +34,7 @@ describe "chooses" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"gender" => "M"})
|
@session.should_receive(:get).with("/login", "user" => {"gender" => "M"})
|
||||||
@session.chooses "Male"
|
|
||||||
@session.clicks_button
|
|
||||||
end
|
|
||||||
|
|
||||||
it "should use any of the button's labels" do
|
|
||||||
@session.response_body = <<-EOS
|
|
||||||
<form method="get" action="/login">
|
|
||||||
<label for="user_gender_male"><img src="male.jpg" /></label>
|
|
||||||
<input id="user_gender_male" name="user[gender]" type="radio" value="M" />
|
|
||||||
<label for="user_gender_male">Male</label>
|
|
||||||
<label for="user_gender_female"><img src="female.jpg" /></label>
|
|
||||||
<input id="user_gender_female" name="user[gender]" type="radio" value="F" />
|
|
||||||
<label for="user_gender_female">Female</label>
|
|
||||||
<input type="submit" />
|
|
||||||
</form>
|
|
||||||
EOS
|
|
||||||
@session.expects(:get).with("/login", "user" => {"gender" => "M"})
|
|
||||||
@session.chooses "Male"
|
@session.chooses "Male"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -66,7 +49,7 @@ describe "chooses" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"gender" => "M"})
|
@session.should_receive(:get).with("/login", "user" => {"gender" => "M"})
|
||||||
@session.chooses "Female"
|
@session.chooses "Female"
|
||||||
@session.chooses "Male"
|
@session.chooses "Male"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
@ -79,7 +62,7 @@ describe "chooses" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "first_option" => "on")
|
@session.should_receive(:post).with("/login", "first_option" => "on")
|
||||||
@session.chooses "first_option"
|
@session.chooses "first_option"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -91,7 +74,7 @@ describe "chooses" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "first_option" => "on")
|
@session.should_receive(:post).with("/login", "first_option" => "on")
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -29,7 +29,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get)
|
@session.should_receive(:get)
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/form1", {})
|
@session.should_receive(:get).with("/form1", {})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" value="Form2" />
|
<input type="submit" value="Form2" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/form2", {})
|
@session.should_receive(:get).with("/form2", {})
|
||||||
@session.clicks_button "Form2"
|
@session.clicks_button "Form2"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", {})
|
@session.should_receive(:get).with("/login", {})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post)
|
@session.should_receive(:post)
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" name="login" value="Login" />
|
<input type="submit" name="login" value="Login" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "login" => "Login")
|
@session.should_receive(:post).with("/login", "login" => "Login")
|
||||||
@session.clicks_button("Login")
|
@session.clicks_button("Login")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" value="Login" />
|
<input type="submit" value="Login" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", {})
|
@session.should_receive(:post).with("/login", {})
|
||||||
@session.clicks_button("Login")
|
@session.clicks_button("Login")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"password" => "mypass"})
|
@session.should_receive(:get).with("/login", "user" => {"password" => "mypass"})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"email" => "test@example.com"})
|
@session.should_receive(:get).with("/login", "user" => {"email" => "test@example.com"})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"email" => "test@example.com"})
|
@session.should_receive(:get).with("/login", "user" => {"email" => "test@example.com"})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"tos" => "1"})
|
@session.should_receive(:get).with("/login", "user" => {"tos" => "1"})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"gender" => "F"})
|
@session.should_receive(:get).with("/login", "user" => {"gender" => "F"})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"tos" => "0"})
|
@session.should_receive(:get).with("/login", "user" => {"tos" => "0"})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"tos" => "1"})
|
@session.should_receive(:get).with("/login", "user" => {"tos" => "1"})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login",
|
@session.should_receive(:post).with("/login",
|
||||||
"options" => ["burger", "fries", "soda", "soda", "dessert"],
|
"options" => ["burger", "fries", "soda", "soda", "dessert"],
|
||||||
"response" => { "choices" => [{"selected" => "one"}, {"selected" => "two"}, {"selected" => "two"}]})
|
"response" => { "choices" => [{"selected" => "one"}, {"selected" => "two"}, {"selected" => "two"}]})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
@ -232,7 +232,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", {})
|
@session.should_receive(:get).with("/login", {})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/posts", "post" => {"body" => "Post body here!"})
|
@session.should_receive(:post).with("/posts", "post" => {"body" => "Post body here!"})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "month" => "2")
|
@session.should_receive(:get).with("/login", "month" => "2")
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "month" => "February")
|
@session.should_receive(:get).with("/login", "month" => "February")
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "month" => "1")
|
@session.should_receive(:get).with("/login", "month" => "1")
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "contestant" => {"scores" => {'1' => '2', '3' => '4'}})
|
@session.should_receive(:post).with("/login", "contestant" => {"scores" => {'1' => '2', '3' => '4'}})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ describe "clicks_button" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"email" => ""})
|
@session.should_receive(:get).with("/login", "user" => {"email" => ""})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ describe "clicks_button" do
|
|||||||
<button type="submit" />
|
<button type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"email" => ""})
|
@session.should_receive(:get).with("/login", "user" => {"email" => ""})
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ describe "clicks_button" do
|
|||||||
<input type="image" />
|
<input type="image" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get)
|
@session.should_receive(:get)
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -339,7 +339,7 @@ describe "clicks_button" do
|
|||||||
<input type="image" alt="Go" />
|
<input type="image" alt="Go" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get)
|
@session.should_receive(:get)
|
||||||
@session.clicks_button "Go"
|
@session.clicks_button "Go"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -350,7 +350,7 @@ describe "clicks_button" do
|
|||||||
<button type="submit">Login</button>
|
<button type="submit">Login</button>
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/login", "user" => {"email" => ""})
|
@session.should_receive(:get).with("/login", "user" => {"email" => ""})
|
||||||
@session.clicks_button "Login"
|
@session.clicks_button "Login"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ describe "clicks_link" do
|
|||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="/page">Link text</a>
|
<a href="/page">Link text</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/page", {})
|
@session.should_receive(:get).with("/page", {})
|
||||||
@session.clicks_link "Link text"
|
@session.clicks_link "Link text"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ describe "clicks_link" do
|
|||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="/page">Link text</a>
|
<a href="/page">Link text</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/page", {})
|
@session.should_receive(:get).with("/page", {})
|
||||||
@session.clicks_get_link "Link text"
|
@session.clicks_get_link "Link text"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ describe "clicks_link" do
|
|||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="/page">Link text</a>
|
<a href="/page">Link text</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:delete).with("/page", {})
|
@session.should_receive(:delete).with("/page", {})
|
||||||
@session.clicks_delete_link "Link text"
|
@session.clicks_delete_link "Link text"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ describe "clicks_link" do
|
|||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="/page">Link text</a>
|
<a href="/page">Link text</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/page", {})
|
@session.should_receive(:post).with("/page", {})
|
||||||
@session.clicks_post_link "Link text"
|
@session.clicks_post_link "Link text"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ describe "clicks_link" do
|
|||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="/page">Link text</a>
|
<a href="/page">Link text</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:put).with("/page", {})
|
@session.should_receive(:put).with("/page", {})
|
||||||
@session.clicks_put_link "Link text"
|
@session.clicks_put_link "Link text"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ describe "clicks_link" do
|
|||||||
f.submit();
|
f.submit();
|
||||||
return false;">Posts</a>
|
return false;">Posts</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/posts", "authenticity_token" => "aa79cb354597a60a3786e7e291ed4f74d77d3a62")
|
@session.should_receive(:post).with("/posts", "authenticity_token" => "aa79cb354597a60a3786e7e291ed4f74d77d3a62")
|
||||||
@session.clicks_link "Posts"
|
@session.clicks_link "Posts"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ describe "clicks_link" do
|
|||||||
f.submit();
|
f.submit();
|
||||||
return false;">Delete</a>
|
return false;">Delete</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:delete).with("/posts/1", {})
|
@session.should_receive(:delete).with("/posts/1", {})
|
||||||
@session.clicks_link "Delete"
|
@session.clicks_link "Delete"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ describe "clicks_link" do
|
|||||||
f.submit();
|
f.submit();
|
||||||
return false;">Posts</a>
|
return false;">Posts</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/posts", {})
|
@session.should_receive(:post).with("/posts", {})
|
||||||
@session.clicks_link "Posts"
|
@session.clicks_link "Posts"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ describe "clicks_link" do
|
|||||||
f.submit();
|
f.submit();
|
||||||
return false;">Posts</a>
|
return false;">Posts</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/posts", {})
|
@session.should_receive(:get).with("/posts", {})
|
||||||
@session.clicks_link "Posts", :javascript => false
|
@session.clicks_link "Posts", :javascript => false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ describe "clicks_link" do
|
|||||||
f.submit();
|
f.submit();
|
||||||
return false;">Put</a></h2>
|
return false;">Put</a></h2>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:put).with("/posts", {})
|
@session.should_receive(:put).with("/posts", {})
|
||||||
@session.clicks_link "Put"
|
@session.clicks_link "Put"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ describe "clicks_link" do
|
|||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="/page">Link text</a>
|
<a href="/page">Link text</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/page", {})
|
@session.should_receive(:get).with("/page", {})
|
||||||
@session.clicks_link "LINK TEXT"
|
@session.clicks_link "LINK TEXT"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ describe "clicks_link" do
|
|||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="/page">This is some cool link text, isn't it?</a>
|
<a href="/page">This is some cool link text, isn't it?</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/page", {})
|
@session.should_receive(:get).with("/page", {})
|
||||||
@session.clicks_link "Link text"
|
@session.clicks_link "Link text"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -158,24 +158,16 @@ describe "clicks_link" do
|
|||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="/page"><span>Link text</span></a>
|
<a href="/page"><span>Link text</span></a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/page", {})
|
@session.should_receive(:get).with("/page", {})
|
||||||
@session.clicks_link "Link text"
|
@session.clicks_link "Link text"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should work with anchor titles" do
|
|
||||||
@session.response_body = <<-EOS
|
|
||||||
<a href="/page" title="Link title">Link text</a>
|
|
||||||
EOS
|
|
||||||
@session.expects(:get).with("/page", {})
|
|
||||||
@session.clicks_link "Link title"
|
|
||||||
end
|
|
||||||
|
|
||||||
it "should match the first matching link" do
|
it "should match the first matching link" do
|
||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="/page1">Link text</a>
|
<a href="/page1">Link text</a>
|
||||||
<a href="/page2">Link text</a>
|
<a href="/page2">Link text</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/page1", {})
|
@session.should_receive(:get).with("/page1", {})
|
||||||
@session.clicks_link "Link text"
|
@session.clicks_link "Link text"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -185,7 +177,7 @@ describe "clicks_link" do
|
|||||||
<a href="/page2">Link</a>
|
<a href="/page2">Link</a>
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
@session.expects(:get).with("/page2", {})
|
@session.should_receive(:get).with("/page2", {})
|
||||||
@session.clicks_link "Link"
|
@session.clicks_link "Link"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -197,7 +189,7 @@ describe "clicks_link" do
|
|||||||
</div>
|
</div>
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
@session.expects(:get).with("/page2", {})
|
@session.should_receive(:get).with("/page2", {})
|
||||||
@session.clicks_link_within "#container", "Link"
|
@session.clicks_link_within "#container", "Link"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -205,17 +197,17 @@ describe "clicks_link" do
|
|||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="#section-1">Jump to Section 1</a>
|
<a href="#section-1">Jump to Section 1</a>
|
||||||
EOS
|
EOS
|
||||||
# Don't know why @session.expects(:get).never doesn't work here
|
# Don't know why @session.should_receive(:get).never doesn't work here
|
||||||
@session.expects(:send).with('get_via_redirect', '#section-1', {}).never
|
@session.should_receive(:send).with('get_via_redirect', '#section-1', {}).never
|
||||||
@session.clicks_link "Jump to Section 1"
|
@session.clicks_link "Jump to Section 1"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should follow relative links" do
|
it "should follow relative links" do
|
||||||
@session.current_page.stubs(:url).returns("/page")
|
@session.current_page.stub!(:url).and_return("/page")
|
||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="sub">Jump to sub page</a>
|
<a href="sub">Jump to sub page</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/page/sub", {})
|
@session.should_receive(:get).with("/page/sub", {})
|
||||||
@session.clicks_link "Jump to sub page"
|
@session.clicks_link "Jump to sub page"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -223,16 +215,16 @@ describe "clicks_link" do
|
|||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="http://www.example.com/page/sub">Jump to sub page</a>
|
<a href="http://www.example.com/page/sub">Jump to sub page</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/page/sub", {})
|
@session.should_receive(:get).with("/page/sub", {})
|
||||||
@session.clicks_link "Jump to sub page"
|
@session.clicks_link "Jump to sub page"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should follow query parameters" do
|
it "should follow query parameters" do
|
||||||
@session.current_page.stubs(:url).returns("/page")
|
@session.current_page.stub!(:url).and_return("/page")
|
||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="?foo=bar">Jump to foo bar</a>
|
<a href="?foo=bar">Jump to foo bar</a>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:get).with("/page?foo=bar", {})
|
@session.should_receive(:get).with("/page?foo=bar", {})
|
||||||
@session.clicks_link "Jump to foo bar"
|
@session.clicks_link "Jump to foo bar"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -13,7 +13,7 @@ describe "fills_in" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "user" => {"text" => "filling text area"})
|
@session.should_receive(:post).with("/login", "user" => {"text" => "filling text area"})
|
||||||
@session.fills_in "User Text", :with => "filling text area"
|
@session.fills_in "User Text", :with => "filling text area"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -25,7 +25,7 @@ describe "fills_in" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "user" => {"text" => "pass"})
|
@session.should_receive(:post).with("/login", "user" => {"text" => "pass"})
|
||||||
@session.fills_in "user_text", :with => "pass"
|
@session.fills_in "user_text", :with => "pass"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -47,7 +47,7 @@ describe "fills_in" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "user" => {"email" => "foo@example.com"})
|
@session.should_receive(:post).with("/login", "user" => {"email" => "foo@example.com"})
|
||||||
@session.fills_in "user[email]", :with => "foo@example.com"
|
@session.fills_in "user[email]", :with => "foo@example.com"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -63,7 +63,7 @@ describe "fills_in" do
|
|||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
@session.expects(:post).with("/login", "user" => {"mail1" => "", "mail2" => "value"})
|
@session.should_receive(:post).with("/login", "user" => {"mail1" => "", "mail2" => "value"})
|
||||||
@session.fills_in "Some", :with => "value"
|
@session.fills_in "Some", :with => "value"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -79,24 +79,11 @@ describe "fills_in" do
|
|||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
@session.expects(:post).with("/login", "user" => {"mail1" => "value", "mail2" => ""})
|
@session.should_receive(:post).with("/login", "user" => {"mail1" => "value", "mail2" => ""})
|
||||||
@session.fills_in "Some mail", :with => "value"
|
@session.fills_in "Some mail", :with => "value"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should support unlabelled inputs" do # regression test
|
|
||||||
@session.response_body = <<-EOS
|
|
||||||
<form method="post" action="/login">
|
|
||||||
<input id="user_name" name="user[name]" value="test person" type="text" />
|
|
||||||
<label for="user_email">email</label>
|
|
||||||
<input id="user_email" name="user[email]" value="test@example.com" type="text" />
|
|
||||||
<input id="user_address" name="user[address]" value="123 some street" type="text" />
|
|
||||||
</form>
|
|
||||||
EOS
|
|
||||||
|
|
||||||
lambda { @session.fills_in "email", :with => "value" }.should_not raise_error
|
|
||||||
end
|
|
||||||
|
|
||||||
it "should anchor label matches to start of label" do
|
it "should anchor label matches to start of label" do
|
||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<form method="post" action="/login">
|
<form method="post" action="/login">
|
||||||
@ -129,7 +116,7 @@ describe "fills_in" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "user" => {"email" => "foo@example.com"})
|
@session.should_receive(:post).with("/login", "user" => {"email" => "foo@example.com"})
|
||||||
@session.fills_in "Email", :with => "foo@example.com"
|
@session.fills_in "Email", :with => "foo@example.com"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -141,7 +128,7 @@ describe "fills_in" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "user" => {"email" => "foo@example.com"})
|
@session.should_receive(:post).with("/login", "user" => {"email" => "foo@example.com"})
|
||||||
@session.fills_in "user[email]", :with => "foo@example.com"
|
@session.fills_in "user[email]", :with => "foo@example.com"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -154,7 +141,7 @@ describe "fills_in" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "user" => {"email" => "foo@example.com"})
|
@session.should_receive(:post).with("/login", "user" => {"email" => "foo@example.com"})
|
||||||
@session.fills_in :email, :with => "foo@example.com"
|
@session.fills_in :email, :with => "foo@example.com"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@ describe "reloads" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should reload the page" do
|
it "should reload the page" do
|
||||||
@session.expects(:get).with("/", {}).times(2)
|
@session.should_receive(:get).with("/", {}).twice
|
||||||
@session.visits("/")
|
@session.visits("/")
|
||||||
@session.reloads
|
@session.reloads
|
||||||
end
|
end
|
||||||
|
@ -16,33 +16,33 @@ describe "save_and_open_page" do
|
|||||||
</html>
|
</html>
|
||||||
HTML
|
HTML
|
||||||
|
|
||||||
File.stubs(:exist?).returns(true)
|
File.stub!(:exist?).and_return(true)
|
||||||
Time.stubs(:now).returns(1234)
|
Time.stub!(:now).and_return(1234)
|
||||||
Webrat::Page.any_instance.stubs(:open_in_browser)
|
@session.current_page.stub!(:open_in_browser)
|
||||||
|
|
||||||
@file_handle = mock()
|
@file_handle = mock("file handle")
|
||||||
File.stubs(:open).with(filename, 'w').yields(@file_handle)
|
File.stub!(:open).with(filename, 'w').and_yield(@file_handle)
|
||||||
@file_handle.stubs(:write)
|
@file_handle.stub!(:write)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should rewrite css rules" do
|
it "should rewrite css rules" do
|
||||||
@file_handle.expects(:write).with do |html|
|
@file_handle.should_receive(:write) do |html|
|
||||||
html =~ %r|#{@session.doc_root}/stylesheets/foo.css|s
|
html.should =~ %r|#{@session.doc_root}/stylesheets/foo.css|s
|
||||||
end
|
end
|
||||||
|
|
||||||
@session.save_and_open_page
|
@session.save_and_open_page
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should rewrite image paths" do
|
it "should rewrite image paths" do
|
||||||
@file_handle.expects(:write).with do |html|
|
@file_handle.should_receive(:write) do |html|
|
||||||
html =~ %r|#{@session.doc_root}/images/bar.png|s
|
html.should =~ %r|#{@session.doc_root}/images/bar.png|s
|
||||||
end
|
end
|
||||||
|
|
||||||
@session.save_and_open_page
|
@session.save_and_open_page
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should open the temp file in a browser" do
|
it "should open the temp file in a browser" do
|
||||||
Webrat::Page.any_instance.expects(:open_in_browser).with(filename)
|
@session.current_page.should_receive(:open_in_browser).with(filename)
|
||||||
@session.save_and_open_page
|
@session.save_and_open_page
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ describe "selects" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "month" => "1")
|
@session.should_receive(:post).with("/login", "month" => "1")
|
||||||
@session.selects "January", :from => "month"
|
@session.selects "January", :from => "month"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -55,7 +55,7 @@ describe "selects" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "encoded" => "A & B")
|
@session.should_receive(:post).with("/login", "encoded" => "A & B")
|
||||||
@session.selects "Encoded", :from => "encoded"
|
@session.selects "Encoded", :from => "encoded"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -67,7 +67,7 @@ describe "selects" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", 'month' => '')
|
@session.should_receive(:post).with("/login", 'month' => '')
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ describe "selects" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "month" => "1")
|
@session.should_receive(:post).with("/login", "month" => "1")
|
||||||
@session.selects "January"
|
@session.selects "January"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -91,7 +91,7 @@ describe "selects" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "start_month" => "s1", "end_month" => "e1")
|
@session.should_receive(:post).with("/login", "start_month" => "s1", "end_month" => "e1")
|
||||||
@session.selects "January", :from => "end_month"
|
@session.selects "January", :from => "end_month"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -106,7 +106,7 @@ describe "selects" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "start_month" => "s1", "end_month" => "e1")
|
@session.should_receive(:post).with("/login", "start_month" => "s1", "end_month" => "e1")
|
||||||
@session.selects "January", :from => "End Month"
|
@session.selects "January", :from => "End Month"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -118,7 +118,7 @@ describe "selects" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "month" => "January")
|
@session.should_receive(:post).with("/login", "month" => "January")
|
||||||
@session.selects "January", :from => "month"
|
@session.selects "January", :from => "month"
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -130,7 +130,7 @@ describe "selects" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "month" => "January")
|
@session.should_receive(:post).with("/login", "month" => "January")
|
||||||
@session.selects(/jan/i)
|
@session.selects(/jan/i)
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
@ -145,7 +145,7 @@ describe "selects" do
|
|||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
</form>
|
</form>
|
||||||
EOS
|
EOS
|
||||||
@session.expects(:post).with("/login", "start_month" => "s1", "end_month" => "e1")
|
@session.should_receive(:post).with("/login", "start_month" => "s1", "end_month" => "e1")
|
||||||
@session.selects(/jan/i, :from => "End Month")
|
@session.selects(/jan/i, :from => "End Month")
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@ describe "visits" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should use get" do
|
it "should use get" do
|
||||||
@session.expects(:get).with("/", {})
|
@session.should_receive(:get).with("/", {})
|
||||||
@session.visits("/")
|
@session.visits("/")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
# it "should default to current url" do
|
# it "should default to current url" do
|
||||||
# # @session.current_page.stubs(:url).returns("/page")
|
# # @session.current_page.stub!(:url).and_return("/page")
|
||||||
# @session.response_body = <<-EOS
|
# @session.response_body = <<-EOS
|
||||||
# <form method="get">
|
# <form method="get">
|
||||||
# <input type="submit" />
|
# <input type="submit" />
|
||||||
# </form>
|
# </form>
|
||||||
# EOS
|
# EOS
|
||||||
# @page.stubs(:url).returns("/current")
|
# @page.stub!(:url).and_return("/current")
|
||||||
# @session.expects(:get).with("/current", {})
|
# @session.should_receive(:get).with("/current", {})
|
||||||
# @session.clicks_button
|
# @session.clicks_button
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
@ -14,7 +14,7 @@
|
|||||||
# @session.response_body = <<-EOS
|
# @session.response_body = <<-EOS
|
||||||
# <a href="https://www.example.com/page/sub">Jump to sub page</a>
|
# <a href="https://www.example.com/page/sub">Jump to sub page</a>
|
||||||
# EOS
|
# EOS
|
||||||
# @session.expects(:https!).with(true)
|
# @session.should_receive(:https!).with(true)
|
||||||
# @session.expects(:get).with("/page/sub", {})
|
# @session.should_receive(:get).with("/page/sub", {})
|
||||||
# @session.clicks_link "Jump to sub page"
|
# @session.clicks_link "Jump to sub page"
|
||||||
# end
|
# end
|
@ -1,8 +1,8 @@
|
|||||||
require "rubygems"
|
require "rubygems"
|
||||||
require "spec"
|
require "spec"
|
||||||
|
|
||||||
# gem install redgreen for colored test output
|
# gem install redgreen for colored test output
|
||||||
begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
|
begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
|
||||||
require "mocha"
|
|
||||||
|
|
||||||
require "active_support"
|
require "active_support"
|
||||||
|
|
||||||
@ -15,5 +15,5 @@ require File.expand_path(File.dirname(__FILE__) + "/../lib/webrat")
|
|||||||
require File.dirname(__FILE__) + "/fakes/test_session"
|
require File.dirname(__FILE__) + "/fakes/test_session"
|
||||||
|
|
||||||
Spec::Runner.configure do |config|
|
Spec::Runner.configure do |config|
|
||||||
config.mock_with :mocha
|
# Nothing to configure yet
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user