Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

switch from == to eq to remove warnings

  • Loading branch information...
commit e0565fb5d2b1c2d2292662437d8f49eb7334ac66 1 parent a7adb74
@JonRowe JonRowe authored
View
12 spec/browser_spec.rb
@@ -202,7 +202,7 @@
:user => @user,
:pass => @pass)
browser.visit @url
- @proxy_requests.size.should == 2
+ @proxy_requests.size.should eq 2
@request = @proxy_requests[-1]
end
@@ -223,8 +223,8 @@
auth_header.should_not be nil
user, pass = Base64.decode64(auth_header.split(/\s+/)[-1]).split(":")
- user.should == @user
- pass.should == @pass
+ user.should eq @user
+ pass.should eq @pass
end
it "uses the proxies' response" do
@@ -232,19 +232,19 @@
end
it 'uses original URL' do
- browser.current_url.should == @url
+ browser.current_url.should eq @url
end
it 'uses URLs changed by javascript' do
browser.execute_script "window.history.pushState('', '', '/blah')"
- browser.current_url.should == 'http://example.org/blah'
+ browser.current_url.should eq 'http://example.org/blah'
end
it 'is possible to disable proxy again' do
@proxy_requests.clear
browser.clear_proxy
browser.visit "http://#{@host}:#{@port}/"
- @proxy_requests.size.should == 0
+ @proxy_requests.size.should eq 0
end
end
View
6 spec/connection_spec.rb
@@ -8,11 +8,11 @@
connection.puts 1
connection.puts url.to_s.bytesize
connection.print url
- connection.gets.should == "ok\n"
- connection.gets.should == "0\n"
+ connection.gets.should eq "ok\n"
+ connection.gets.should eq "0\n"
connection.puts "Body"
connection.puts 0
- connection.gets.should == "ok\n"
+ connection.gets.should eq "ok\n"
response_length = connection.gets.to_i
response = connection.read(response_length)
response.should include("Hey there")
View
18 spec/cookie_jar_spec.rb
@@ -17,32 +17,32 @@
describe "#find" do
it "returns a cookie object" do
- subject.find("cookie1", "www.facebook.com").domain.should == ".facebook.com"
+ subject.find("cookie1", "www.facebook.com").domain.should eq ".facebook.com"
end
it "returns the right cookie for every given domain/path" do
- subject.find("cookie1", "example.org").value.should == "1"
- subject.find("cookie1", "www.facebook.com").value.should == "3"
- subject.find("cookie2", "sub1.example.org").value.should == "4"
+ subject.find("cookie1", "example.org").value.should eq "1"
+ subject.find("cookie1", "www.facebook.com").value.should eq "3"
+ subject.find("cookie2", "sub1.example.org").value.should eq "4"
end
it "does not return a cookie from other domain" do
- subject.find("cookie2", "www.example.org").should == nil
+ subject.find("cookie2", "www.example.org").should eq nil
end
it "respects path precedence rules" do
- subject.find("cookie1", "www.example.org").value.should == "1"
- subject.find("cookie1", "www.example.org", "/dir1/123").value.should == "2"
+ subject.find("cookie1", "www.example.org").value.should eq "1"
+ subject.find("cookie1", "www.example.org", "/dir1/123").value.should eq "2"
end
end
describe "#[]" do
it "returns the first matching cookie's value" do
- subject["cookie1", "example.org"].should == "1"
+ subject["cookie1", "example.org"].should eq "1"
end
it "returns nil if no cookie is found" do
- subject["notexisting"].should == nil
+ subject["notexisting"].should eq nil
end
end
end
View
18 spec/driver_rendering_spec.rb
@@ -34,7 +34,7 @@ def render(options)
before { render({}) }
it "should be a PNG" do
- @image[:format].should == "PNG"
+ @image[:format].should eq "PNG"
end
it "width default to 1000px (with 15px less for the scrollbar)" do
@@ -51,16 +51,16 @@ def render(options)
before { render(:width => 500, :height => 400) }
it "width should match the width given" do
- @image[:width].should == 500
+ @image[:width].should eq 500
end
it "height should match the height given" do
- @image[:height].should == 400
+ @image[:height].should eq 400
end
it "should reset window dimensions to their default value" do
- driver.evaluate_script('window.innerWidth').should == 1680
- driver.evaluate_script('window.innerHeight').should == 1050
+ driver.evaluate_script('window.innerWidth').should eq 1680
+ driver.evaluate_script('window.innerHeight').should eq 1050
end
end
@@ -76,8 +76,8 @@ def render(options)
end
it "should restore viewport dimensions after rendering" do
- driver.evaluate_script('window.innerWidth').should == 1680
- driver.evaluate_script('window.innerHeight').should == 1050
+ driver.evaluate_script('window.innerWidth').should eq 1680
+ driver.evaluate_script('window.innerHeight').should eq 1050
end
end
@@ -86,8 +86,8 @@ def render(options)
it "should restore viewport dimensions after rendering" do
render({})
- driver.evaluate_script('window.innerWidth').should == 800
- driver.evaluate_script('window.innerHeight').should == 600
+ driver.evaluate_script('window.innerWidth').should eq 800
+ driver.evaluate_script('window.innerHeight').should eq 600
end
end
end
View
336 spec/driver_spec.rb
@@ -93,7 +93,7 @@ def visit(url, driver=driver)
it "returns an attribute's value" do
driver.within_frame("f") do
- driver.find_xpath("//p").first["id"].should == "farewell"
+ driver.find_xpath("//p").first["id"].should eq "farewell"
end
end
@@ -108,20 +108,20 @@ def visit(url, driver=driver)
it "returns a node's text" do
driver.within_frame("f") do
- driver.find_xpath("//p").first.visible_text.should == "goodbye"
+ driver.find_xpath("//p").first.visible_text.should eq "goodbye"
end
end
it "returns the current URL" do
driver.within_frame("f") do
- driver.current_url.should == driver_url(driver, "/iframe")
+ driver.current_url.should eq driver_url(driver, "/iframe")
end
end
it "evaluates Javascript" do
driver.within_frame("f") do
result = driver.evaluate_script(%<document.getElementById('farewell').innerText>)
- result.should == "goodbye"
+ result.should eq "goodbye"
end
end
@@ -137,24 +137,24 @@ def visit(url, driver=driver)
driver.within_frame("f") {}
- driver.current_url.should == original_url
+ driver.current_url.should eq original_url
end
it "returns the headers for the page" do
driver.within_frame("f") do
- driver.response_headers['X-Redirected'].should == "true"
+ driver.response_headers['X-Redirected'].should eq "true"
end
end
it "returns the status code for the page" do
driver.within_frame("f") do
- driver.status_code.should == 200
+ driver.status_code.should eq 200
end
end
it "returns the document title" do
driver.within_frame("f") do
- driver.title.should == "Title"
+ driver.title.should eq "Title"
end
end
end
@@ -223,35 +223,35 @@ def visit(url, driver=driver)
it "should redirect without content type" do
visit("/form")
driver.find_xpath("//input").first.click
- driver.find_xpath("//p").first.visible_text.should == ""
+ driver.find_xpath("//p").first.visible_text.should eq ""
end
it "returns the current URL when changed by pushState after a redirect" do
visit("/redirect-me")
- driver.current_url.should == driver_url(driver, "/target")
+ driver.current_url.should eq driver_url(driver, "/target")
driver.execute_script("window.history.pushState({}, '', '/pushed-after-redirect')")
- driver.current_url.should == driver_url(driver, "/pushed-after-redirect")
+ driver.current_url.should eq driver_url(driver, "/pushed-after-redirect")
end
it "returns the current URL when changed by replaceState after a redirect" do
visit("/redirect-me")
- driver.current_url.should == driver_url(driver, "/target")
+ driver.current_url.should eq driver_url(driver, "/target")
driver.execute_script("window.history.replaceState({}, '', '/replaced-after-redirect')")
- driver.current_url.should == driver_url(driver, "/replaced-after-redirect")
+ driver.current_url.should eq driver_url(driver, "/replaced-after-redirect")
end
it "should make headers available through response_headers" do
visit('/redirect-me')
- driver.response_headers['X-Redirected'].should == "true"
+ driver.response_headers['X-Redirected'].should eq "true"
visit('/target')
- driver.response_headers['X-Redirected'].should == "false"
+ driver.response_headers['X-Redirected'].should eq "false"
end
it "should make the status code available through status_code" do
visit('/redirect-me')
- driver.status_code.should == 200
+ driver.status_code.should eq 200
visit('/target')
- driver.status_code.should == 200
+ driver.status_code.should eq 200
end
end
@@ -272,7 +272,7 @@ def visit(url, driver=driver)
end
it "sets the response headers with respect to the unsupported request" do
- driver.response_headers["Content-Type"].should == "text/css"
+ driver.response_headers["Content-Type"].should eq "text/css"
end
it "does not wrap the content in HTML tags" do
@@ -315,7 +315,7 @@ def visit(url, driver=driver)
it "should return the binary content" do
src = driver.html.force_encoding('binary')
- src.should == "Hello\xFF\xFF\xFF\xFFWorld".force_encoding('binary')
+ src.should eq "Hello\xFF\xFF\xFF\xFFWorld".force_encoding('binary')
end
end
@@ -371,7 +371,7 @@ def visit(url, driver=driver)
it "has a blank location after reseting" do
driver.reset!
- driver.current_url.should == "about:blank"
+ driver.current_url.should eq "about:blank"
end
it "raises an error for an invalid xpath query" do
@@ -385,7 +385,7 @@ def visit(url, driver=driver)
end
it "returns an attribute's value" do
- driver.find_xpath("//p").first["id"].should == "greeting"
+ driver.find_xpath("//p").first["id"].should eq "greeting"
end
it "parses xpath with quotes" do
@@ -393,30 +393,30 @@ def visit(url, driver=driver)
end
it "returns a node's visible text" do
- driver.find_xpath("//*[@id='hidden-text']").first.visible_text.should == "Some of this text is"
+ driver.find_xpath("//*[@id='hidden-text']").first.visible_text.should eq "Some of this text is"
end
it "normalizes a node's text" do
- driver.find_xpath("//div[contains(@class, 'normalize')]").first.visible_text.should == "Spaces not normalized"
+ driver.find_xpath("//div[contains(@class, 'normalize')]").first.visible_text.should eq "Spaces not normalized"
end
it "returns all of a node's text" do
- driver.find_xpath("//*[@id='hidden-text']").first.all_text.should == "Some of this text is hidden!"
+ driver.find_xpath("//*[@id='hidden-text']").first.all_text.should eq "Some of this text is hidden!"
end
it "returns the current URL" do
visit "/hello/world?success=true"
- driver.current_url.should == driver_url(driver, "/hello/world?success=true")
+ driver.current_url.should eq driver_url(driver, "/hello/world?success=true")
end
it "returns the current URL when changed by pushState" do
driver.execute_script("window.history.pushState({}, '', '/pushed')")
- driver.current_url.should == driver_url(driver, "/pushed")
+ driver.current_url.should eq driver_url(driver, "/pushed")
end
it "returns the current URL when changed by replaceState" do
driver.execute_script("window.history.replaceState({}, '', '/replaced')")
- driver.current_url.should == driver_url(driver, "/replaced")
+ driver.current_url.should eq driver_url(driver, "/replaced")
end
it "does not double-encode URLs" do
@@ -431,37 +431,37 @@ def visit(url, driver=driver)
it "evaluates Javascript and returns a string" do
result = driver.evaluate_script(%<document.getElementById('greeting').innerText>)
- result.should == "hello"
+ result.should eq "hello"
end
it "evaluates Javascript and returns an array" do
result = driver.evaluate_script(%<["hello", "world"]>)
- result.should == %w(hello world)
+ result.should eq %w(hello world)
end
it "evaluates Javascript and returns an int" do
result = driver.evaluate_script(%<123>)
- result.should == 123
+ result.should eq 123
end
it "evaluates Javascript and returns a float" do
result = driver.evaluate_script(%<1.5>)
- result.should == 1.5
+ result.should eq 1.5
end
it "evaluates Javascript and returns null" do
result = driver.evaluate_script(%<(function () {})()>)
- result.should == nil
+ result.should eq nil
end
it "evaluates Infinity and returns null" do
result = driver.evaluate_script(%<Infinity>)
- result.should == nil
+ result.should eq nil
end
it "evaluates Javascript and returns an object" do
result = driver.evaluate_script(%<({ 'one' : 1 })>)
- result.should == { 'one' => 1 }
+ result.should eq 'one' => 1
end
it "evaluates Javascript and returns true" do
@@ -481,7 +481,7 @@ def visit(url, driver=driver)
it "evaluates Javascript with multiple lines" do
result = driver.evaluate_script("[1,\n2]")
- result.should == [1, 2]
+ result.should eq [1, 2]
end
it "executes Javascript" do
@@ -500,7 +500,7 @@ def visit(url, driver=driver)
end
it "returns a node's tag name" do
- driver.find_xpath("//p").first.tag_name.should == "p"
+ driver.find_xpath("//p").first.tag_name.should eq "p"
end
it "reads disabled property" do
@@ -518,11 +518,11 @@ def visit(url, driver=driver)
end
it "returns the document title" do
- driver.title.should == "Title"
+ driver.title.should eq "Title"
end
it "finds elements by CSS" do
- driver.find_css("p").first.visible_text.should == "hello"
+ driver.find_css("p").first.visible_text.should eq "hello"
end
end
@@ -542,7 +542,7 @@ def visit(url, driver=driver)
before { visit("/") }
it "should handle text for svg elements" do
- driver.find_xpath("//*[@id='navy_text']").first.visible_text.should == "In the navy!"
+ driver.find_xpath("//*[@id='navy_text']").first.visible_text.should eq "In the navy!"
end
end
@@ -582,7 +582,7 @@ def visit(url, driver=driver)
it "supports multi-line console messages" do
message = driver.console_messages[2]
- message[:message].should == "hello\nnewline"
+ message[:message].should eq "hello\nnewline"
end
it "empties the array when reset" do
@@ -592,13 +592,13 @@ def visit(url, driver=driver)
it "supports console messages from an unknown source" do
driver.execute_script("console.log('hello')")
- driver.console_messages.last[:message].should == 'hello'
+ driver.console_messages.last[:message].should eq 'hello'
driver.console_messages.last[:source].should be_nil
driver.console_messages.last[:line_number].should be_nil
end
it "escapes unicode console messages" do
- driver.console_messages[3][:message].should == '𝄞'
+ driver.console_messages[3][:message].should eq '𝄞'
end
end
@@ -621,7 +621,7 @@ def visit(url, driver=driver)
before { visit("/") }
it "should let me read my alert messages" do
- driver.alert_messages.first.should == "Alert Text\nGoes Here"
+ driver.alert_messages.first.should eq "Alert Text\nGoes Here"
end
it "empties the array when reset" do
@@ -655,25 +655,25 @@ def visit(url, driver=driver)
it "should default to accept the confirm" do
driver.find_xpath("//input").first.click
- driver.console_messages.first[:message].should == "hello"
+ driver.console_messages.first[:message].should eq "hello"
end
it "can dismiss the confirm" do
driver.dismiss_js_confirms!
driver.find_xpath("//input").first.click
- driver.console_messages.first[:message].should == "goodbye"
+ driver.console_messages.first[:message].should eq "goodbye"
end
it "can accept the confirm explicitly" do
driver.dismiss_js_confirms!
driver.accept_js_confirms!
driver.find_xpath("//input").first.click
- driver.console_messages.first[:message].should == "hello"
+ driver.console_messages.first[:message].should eq "hello"
end
it "should collect the javsacript confirm dialog contents" do
driver.find_xpath("//input").first.click
- driver.confirm_messages.first.should == "Yes?"
+ driver.confirm_messages.first.should eq "Yes?"
end
it "empties the array when reset" do
@@ -687,12 +687,12 @@ def visit(url, driver=driver)
driver.reset!
visit("/")
driver.find_xpath("//input").first.click
- driver.console_messages.first[:message].should == "hello"
+ driver.console_messages.first[:message].should eq "hello"
end
it "supports multi-line confirmation messages" do
driver.execute_script("confirm('Hello\\nnewline')")
- driver.confirm_messages.first.should == "Hello\nnewline"
+ driver.confirm_messages.first.should eq "Hello\nnewline"
end
end
@@ -723,42 +723,42 @@ def visit(url, driver=driver)
it "should default to dismiss the prompt" do
driver.find_xpath("//input").first.click
- driver.console_messages.first[:message].should == "goodbye"
+ driver.console_messages.first[:message].should eq "goodbye"
end
it "can accept the prompt without providing text" do
driver.accept_js_prompts!
driver.find_xpath("//input").first.click
- driver.console_messages.first[:message].should == "hello John Smith"
+ driver.console_messages.first[:message].should eq "hello John Smith"
end
it "can accept the prompt with input" do
driver.js_prompt_input = "Capy"
driver.accept_js_prompts!
driver.find_xpath("//input").first.click
- driver.console_messages.first[:message].should == "hello Capy"
+ driver.console_messages.first[:message].should eq "hello Capy"
end
it "can return to dismiss the prompt after accepting prompts" do
driver.accept_js_prompts!
driver.dismiss_js_prompts!
driver.find_xpath("//input").first.click
- driver.console_messages.first[:message].should == "goodbye"
+ driver.console_messages.first[:message].should eq "goodbye"
end
it "should let me remove the prompt input text" do
driver.js_prompt_input = "Capy"
driver.accept_js_prompts!
driver.find_xpath("//input").first.click
- driver.console_messages.first[:message].should == "hello Capy"
+ driver.console_messages.first[:message].should eq "hello Capy"
driver.js_prompt_input = nil
driver.find_xpath("//input").first.click
- driver.console_messages.last[:message].should == "hello John Smith"
+ driver.console_messages.last[:message].should eq "hello John Smith"
end
it "should collect the javsacript prompt dialog contents" do
driver.find_xpath("//input").first.click
- driver.prompt_messages.first.should == "Your name?"
+ driver.prompt_messages.first.should eq "Your name?"
end
it "empties the array when reset" do
@@ -772,12 +772,12 @@ def visit(url, driver=driver)
driver.reset!
visit("/")
driver.find_xpath("//input").first.click
- driver.console_messages.first[:message].should == "goodbye"
+ driver.console_messages.first[:message].should eq "goodbye"
end
it "supports multi-line prompt messages" do
driver.execute_script("prompt('Hello\\nnewline')")
- driver.prompt_messages.first.should == "Hello\nnewline"
+ driver.prompt_messages.first.should eq "Hello\nnewline"
end
end
@@ -825,57 +825,57 @@ def visit(url, driver=driver)
before { visit("/") }
it "returns a textarea's value" do
- driver.find_xpath("//textarea").first.value.should == "what a wonderful area for text"
+ driver.find_xpath("//textarea").first.value.should eq "what a wonderful area for text"
end
it "returns a text input's value" do
- driver.find_xpath("//input").first.value.should == "bar"
+ driver.find_xpath("//input").first.value.should eq "bar"
end
it "returns a select's value" do
- driver.find_xpath("//select").first.value.should == "Capybara"
+ driver.find_xpath("//select").first.value.should eq "Capybara"
end
it "sets an input's value" do
input = driver.find_xpath("//input").first
input.set("newvalue")
- input.value.should == "newvalue"
+ input.value.should eq "newvalue"
end
it "sets an input's value greater than the max length" do
input = driver.find_xpath("//input[@name='maxlength_foo']").first
input.set("allegories (poems)")
- input.value.should == "allegories"
+ input.value.should eq "allegories"
end
it "sets an input's value equal to the max length" do
input = driver.find_xpath("//input[@name='maxlength_foo']").first
input.set("allegories")
- input.value.should == "allegories"
+ input.value.should eq "allegories"
end
it "sets an input's value less than the max length" do
input = driver.find_xpath("//input[@name='maxlength_foo']").first
input.set("poems")
- input.value.should == "poems"
+ input.value.should eq "poems"
end
it "sets an input's nil value" do
input = driver.find_xpath("//input").first
input.set(nil)
- input.value.should == ""
+ input.value.should eq ""
end
it "sets a select's value" do
select = driver.find_xpath("//select").first
select.set("Monkey")
- select.value.should == "Monkey"
+ select.value.should eq "Monkey"
end
it "sets a textarea's value" do
textarea = driver.find_xpath("//textarea").first
textarea.set("newvalue")
- textarea.value.should == "newvalue"
+ textarea.value.should eq "newvalue"
end
let(:monkey_option) { driver.find_xpath("//option[@id='select-option-monkey']").first }
@@ -891,12 +891,12 @@ def visit(url, driver=driver)
context "a select element's selection has been changed" do
before do
- animal_select.value.should == "Capybara"
+ animal_select.value.should eq "Capybara"
monkey_option.select_option
end
it "returns the new selection" do
- animal_select.value.should == "Monkey"
+ animal_select.value.should eq "Monkey"
end
it "does not modify the selected attribute of a new selection" do
@@ -906,7 +906,7 @@ def visit(url, driver=driver)
it "returns the old value when a reset button is clicked" do
reset_button.click
- animal_select.value.should == "Capybara"
+ animal_select.value.should eq "Capybara"
end
end
@@ -945,7 +945,7 @@ def visit(url, driver=driver)
banana_option.unselect_option
cherry_option.unselect_option
- toppings_select.value.should == []
+ toppings_select.value.should eq []
apple_option.select_option
banana_option.select_option
@@ -1007,7 +1007,7 @@ def visit(url, driver=driver)
it "does not modify a readonly input" do
readonly_input = driver.find_css("#readonly_input").first
readonly_input.set('enabled')
- readonly_input.value.should == 'readonly'
+ readonly_input.value.should eq 'readonly'
end
it "should see enabled options in disabled select as disabled" do
@@ -1050,18 +1050,18 @@ def visit(url, driver=driver)
it "triggers mouse events" do
watch.click
- fired_events.should == %w(mousedown mouseup click)
+ fired_events.should eq %w(mousedown mouseup click)
end
it "triggers double click" do
# check event order at http://www.quirksmode.org/dom/events/click.html
watch.double_click
- fired_events.should == %w(mousedown mouseup click mousedown mouseup click dblclick)
+ fired_events.should eq %w(mousedown mouseup click mousedown mouseup click dblclick)
end
it "triggers right click" do
watch.right_click
- fired_events.should == %w(mousedown contextmenu mouseup)
+ fired_events.should eq %w(mousedown contextmenu mouseup)
end
end
@@ -1122,23 +1122,23 @@ def visit(url, driver=driver)
%w(email number password search tel text url).each do | field_type |
it "triggers text input events on inputs of type #{field_type}" do
driver.find_xpath("//input[@type='#{field_type}']").first.set(newtext)
- driver.find_xpath("//li").map(&:visible_text).should == keyevents
+ driver.find_xpath("//li").map(&:visible_text).should eq keyevents
end
end
it "triggers textarea input events" do
driver.find_xpath("//textarea").first.set(newtext)
- driver.find_xpath("//li").map(&:visible_text).should == keyevents
+ driver.find_xpath("//li").map(&:visible_text).should eq keyevents
end
it "triggers radio input events" do
driver.find_xpath("//input[@type='radio']").first.set(true)
- driver.find_xpath("//li").map(&:visible_text).should == %w(mousedown focus mouseup change click)
+ driver.find_xpath("//li").map(&:visible_text).should eq %w(mousedown focus mouseup change click)
end
it "triggers checkbox events" do
driver.find_xpath("//input[@type='checkbox']").first.set(true)
- driver.find_xpath("//li").map(&:visible_text).should == %w(mousedown focus mouseup change click)
+ driver.find_xpath("//li").map(&:visible_text).should eq %w(mousedown focus mouseup change click)
end
end
@@ -1228,10 +1228,10 @@ def visit(url, driver=driver)
it "fires a change on select" do
select = driver.find_xpath("//select").first
- select.value.should == "1"
+ select.value.should eq "1"
option = driver.find_xpath("//option[@id='option-2']").first
option.select_option
- select.value.should == "2"
+ select.value.should eq "2"
driver.find_xpath("//select[@class='triggered']").should_not be_empty
end
@@ -1241,7 +1241,7 @@ def visit(url, driver=driver)
draggable.drag_to(container)
- driver.find_xpath("//*[@class='triggered']").size.should == 1
+ driver.find_xpath("//*[@class='triggered']").size.should eq 1
end
end
@@ -1261,12 +1261,12 @@ def visit(url, driver=driver)
it "evaluates nested xpath expressions" do
parent = driver.find_xpath("//*[@id='parent']").first
- parent.find_xpath("./*[@class='find']").map(&:visible_text).should == %w(Expected)
+ parent.find_xpath("./*[@class='find']").map(&:visible_text).should eq %w(Expected)
end
it "finds elements by CSS" do
parent = driver.find_css("#parent").first
- parent.find_css(".find").first.visible_text.should == "Expected"
+ parent.find_css(".find").first.visible_text.should eq "Expected"
end
end
@@ -1286,7 +1286,7 @@ def visit(url, driver=driver)
end
visit("/", driver)
driver.find_xpath("//a").first.click
- result.should == "finished"
+ result.should eq "finished"
end
end
@@ -1348,7 +1348,7 @@ def wait_for_error_to_complete
driver.find_xpath("//input").first.click
expect { driver.find_xpath("//p") }.to raise_error(Capybara::Webkit::InvalidResponseError)
visit("/")
- driver.find_xpath("//p").first.visible_text.should == "hello"
+ driver.find_xpath("//p").first.visible_text.should eq "hello"
end
end
@@ -1374,7 +1374,7 @@ def wait_for_error_to_complete
before { visit("/") }
it "doesn't crash from alerts" do
- driver.find_xpath("//p").first.visible_text.should == "success"
+ driver.find_xpath("//p").first.visible_text.should eq "success"
end
end
@@ -1404,31 +1404,31 @@ def wait_for_error_to_complete
end
it "can set user_agent" do
- driver.find_xpath('id("user-agent")').first.visible_text.should == 'capybara-webkit/custom-user-agent'
- driver.evaluate_script('navigator.userAgent').should == 'capybara-webkit/custom-user-agent'
+ driver.find_xpath('id("user-agent")').first.visible_text.should eq 'capybara-webkit/custom-user-agent'
+ driver.evaluate_script('navigator.userAgent').should eq 'capybara-webkit/custom-user-agent'
end
it "keep user_agent in next page" do
driver.find_xpath("//a").first.click
- driver.find_xpath('id("user-agent")').first.visible_text.should == 'capybara-webkit/custom-user-agent'
- driver.evaluate_script('navigator.userAgent').should == 'capybara-webkit/custom-user-agent'
+ driver.find_xpath('id("user-agent")').first.visible_text.should eq 'capybara-webkit/custom-user-agent'
+ driver.evaluate_script('navigator.userAgent').should eq 'capybara-webkit/custom-user-agent'
end
it "can set custom header" do
- driver.find_xpath('id("x-capybara-webkit-header")').first.visible_text.should == 'x-capybara-webkit-header'
+ driver.find_xpath('id("x-capybara-webkit-header")').first.visible_text.should eq 'x-capybara-webkit-header'
end
it "can set Accept header" do
- driver.find_xpath('id("accept")').first.visible_text.should == 'text/html'
+ driver.find_xpath('id("accept")').first.visible_text.should eq 'text/html'
end
it "can reset all custom header" do
driver.reset!
visit('/')
- driver.find_xpath('id("user-agent")').first.visible_text.should_not == 'capybara-webkit/custom-user-agent'
- driver.evaluate_script('navigator.userAgent').should_not == 'capybara-webkit/custom-user-agent'
+ driver.find_xpath('id("user-agent")').first.visible_text.should_not eq 'capybara-webkit/custom-user-agent'
+ driver.evaluate_script('navigator.userAgent').should_not eq 'capybara-webkit/custom-user-agent'
driver.find_xpath('id("x-capybara-webkit-header")').first.visible_text.should be_empty
- driver.find_xpath('id("accept")').first.visible_text.should_not == 'text/html'
+ driver.find_xpath('id("accept")').first.visible_text.should_not eq 'text/html'
end
end
@@ -1493,15 +1493,15 @@ def make_the_server_go_away
end
it "ignores custom fonts" do
- font_family.should == "Arial"
+ font_family.should eq "Arial"
end
it "ignores custom fonts before an element" do
- font_family.should == "Arial"
+ font_family.should eq "Arial"
end
it "ignores custom fonts after an element" do
- font_family.should == "Arial"
+ font_family.should eq "Arial"
end
end
@@ -1526,36 +1526,36 @@ def echoed_cookie
end
it "remembers the cookie on second visit" do
- echoed_cookie.should == ""
+ echoed_cookie.should eq ""
visit "/"
- echoed_cookie.should == "abc"
+ echoed_cookie.should eq "abc"
end
it "uses a custom cookie" do
driver.browser.set_cookie 'cookie=abc; domain=127.0.0.1; path=/'
visit "/"
- echoed_cookie.should == "abc"
+ echoed_cookie.should eq "abc"
end
it "clears cookies" do
driver.browser.clear_cookies
visit "/"
- echoed_cookie.should == ""
+ echoed_cookie.should eq ""
end
it "allows enumeration of cookies" do
cookies = driver.browser.get_cookies
- cookies.size.should == 1
+ cookies.size.should eq 1
cookie = Hash[cookies[0].split(/\s*;\s*/).map { |x| x.split("=", 2) }]
- cookie["cookie"].should == "abc"
+ cookie["cookie"].should eq "abc"
cookie["domain"].should include "127.0.0.1"
- cookie["path"].should == "/"
+ cookie["path"].should eq "/"
end
it "allows reading access to cookies using a nice syntax" do
- driver.cookies["cookie"].should == "abc"
+ driver.cookies["cookie"].should eq "abc"
end
end
@@ -1584,7 +1584,7 @@ def set_automatic_reload(value)
it "allows removed nodes when reloading is disabled" do
node = driver.find_xpath("//p[@id='removeMe']").first
driver.evaluate_script("document.getElementById('parent').innerHTML = 'Magic'")
- node.visible_text.should == 'Hello'
+ node.visible_text.should eq 'Hello'
end
end
@@ -1645,8 +1645,8 @@ def set_automatic_reload(value)
cases.each do |xpath, path|
nodes = driver.find_xpath(xpath)
- nodes.size.should == 1
- nodes[0].path.should == path
+ nodes.size.should eq 1
+ nodes[0].path.should eq path
end
end
end
@@ -1670,7 +1670,7 @@ def set_automatic_reload(value)
before { visit("/") }
it "handles overflow hidden" do
- driver.find_xpath("//div[@id='overflow']").first.visible_text.should == "Overflow"
+ driver.find_xpath("//div[@id='overflow']").first.visible_text.should eq "Overflow"
end
end
@@ -1696,7 +1696,7 @@ def set_automatic_reload(value)
it "loads a page without error" do
10.times do
visit("/redirect")
- driver.find_xpath("//p").first.visible_text.should == "finished"
+ driver.find_xpath("//p").first.visible_text.should eq "finished"
end
end
end
@@ -1821,59 +1821,59 @@ def which_for(character)
before { visit("/") }
it "returns the charCode for the keypressed" do
- charCode_for("a").should == "97"
- charCode_for("A").should == "65"
- charCode_for("\r").should == "13"
- charCode_for(",").should == "44"
- charCode_for("<").should == "60"
- charCode_for("0").should == "48"
+ charCode_for("a").should eq "97"
+ charCode_for("A").should eq "65"
+ charCode_for("\r").should eq "13"
+ charCode_for(",").should eq "44"
+ charCode_for("<").should eq "60"
+ charCode_for("0").should eq "48"
end
it "returns the keyCode for the keypressed" do
- keyCode_for("a").should == "97"
- keyCode_for("A").should == "65"
- keyCode_for("\r").should == "13"
- keyCode_for(",").should == "44"
- keyCode_for("<").should == "60"
- keyCode_for("0").should == "48"
+ keyCode_for("a").should eq "97"
+ keyCode_for("A").should eq "65"
+ keyCode_for("\r").should eq "13"
+ keyCode_for(",").should eq "44"
+ keyCode_for("<").should eq "60"
+ keyCode_for("0").should eq "48"
end
it "returns the which for the keypressed" do
- which_for("a").should == "97"
- which_for("A").should == "65"
- which_for("\r").should == "13"
- which_for(",").should == "44"
- which_for("<").should == "60"
- which_for("0").should == "48"
+ which_for("a").should eq "97"
+ which_for("A").should eq "65"
+ which_for("\r").should eq "13"
+ which_for(",").should eq "44"
+ which_for("<").should eq "60"
+ which_for("0").should eq "48"
end
end
shared_examples "a keyupdown app" do
it "returns a 0 charCode for the event" do
- charCode_for("a").should == "0"
- charCode_for("A").should == "0"
- charCode_for("\b").should == "0"
- charCode_for(",").should == "0"
- charCode_for("<").should == "0"
- charCode_for("0").should == "0"
+ charCode_for("a").should eq "0"
+ charCode_for("A").should eq "0"
+ charCode_for("\b").should eq "0"
+ charCode_for(",").should eq "0"
+ charCode_for("<").should eq "0"
+ charCode_for("0").should eq "0"
end
it "returns the keyCode for the event" do
- keyCode_for("a").should == "65"
- keyCode_for("A").should == "65"
- keyCode_for("\b").should == "8"
- keyCode_for(",").should == "188"
- keyCode_for("<").should == "188"
- keyCode_for("0").should == "48"
+ keyCode_for("a").should eq "65"
+ keyCode_for("A").should eq "65"
+ keyCode_for("\b").should eq "8"
+ keyCode_for(",").should eq "188"
+ keyCode_for("<").should eq "188"
+ keyCode_for("0").should eq "48"
end
it "returns the which for the event" do
- which_for("a").should == "65"
- which_for("A").should == "65"
- which_for("\b").should == "8"
- which_for(",").should == "188"
- which_for("<").should == "188"
- which_for("0").should == "48"
+ which_for("a").should eq "65"
+ which_for("A").should eq "65"
+ which_for("\b").should eq "8"
+ which_for(",").should eq "188"
+ which_for("<").should eq "188"
+ which_for("0").should eq "48"
end
end
@@ -1915,14 +1915,14 @@ def which_for(character)
it "has the expected text in the new window" do
visit("/new_window")
driver.within_window(driver.window_handles.last) do
- driver.find_xpath("//p").first.visible_text.should == "finished"
+ driver.find_xpath("//p").first.visible_text.should eq "finished"
end
end
it "waits for the new window to load" do
visit("/new_window?sleep=1")
driver.within_window(driver.window_handles.last) do
- driver.find_xpath("//p").first.visible_text.should == "finished"
+ driver.find_xpath("//p").first.visible_text.should eq "finished"
end
end
@@ -1930,34 +1930,34 @@ def which_for(character)
visit("/new_window?sleep=2")
driver.execute_script("setTimeout(function() { window.location = 'about:blank' }, 1000)")
driver.within_window(driver.window_handles.last) do
- driver.find_xpath("//p").first.visible_text.should == "finished"
+ driver.find_xpath("//p").first.visible_text.should eq "finished"
end
end
it "switches back to the original window" do
visit("/new_window")
driver.within_window(driver.window_handles.last) { }
- driver.find_xpath("//p").first.visible_text.should == "bananas"
+ driver.find_xpath("//p").first.visible_text.should eq "bananas"
end
it "supports finding a window by name" do
visit("/new_window")
driver.within_window('myWindow') do
- driver.find_xpath("//p").first.visible_text.should == "finished"
+ driver.find_xpath("//p").first.visible_text.should eq "finished"
end
end
it "supports finding a window by title" do
visit("/new_window?sleep=5")
driver.within_window('My New Window') do
- driver.find_xpath("//p").first.visible_text.should == "finished"
+ driver.find_xpath("//p").first.visible_text.should eq "finished"
end
end
it "supports finding a window by url" do
visit("/new_window?test")
driver.within_window(driver_url(driver, "/?test")) do
- driver.find_xpath("//p").first.visible_text.should == "finished"
+ driver.find_xpath("//p").first.visible_text.should eq "finished"
end
end
@@ -1967,9 +1967,9 @@ def which_for(character)
end
it "has a number of window handles equal to the number of open windows" do
- driver.window_handles.size.should == 1
+ driver.window_handles.size.should eq 1
visit("/new_window")
- driver.window_handles.size.should == 2
+ driver.window_handles.size.should eq 2
end
it "closes new windows on reset" do
@@ -1999,7 +1999,7 @@ def which_for(character)
end
visit("/new_window", driver)
- driver.cookies['session_id'].should == session_id
+ driver.cookies['session_id'].should eq session_id
end
context "timers app" do
@@ -2081,13 +2081,13 @@ def which_for(character)
driver.browser.authenticate('user1', 'password1')
driver.browser.timeout = 2
lambda { visit("/") }.should_not raise_error(Timeout::Error)
- driver.status_code.should == 401
+ driver.status_code.should eq 401
end
it "returns 401 for unauthenticated request" do
driver.browser.timeout = 2
lambda { visit("/") }.should_not raise_error(Timeout::Error)
- driver.status_code.should == 401
+ driver.status_code.should eq 401
end
end
@@ -2153,14 +2153,14 @@ def which_for(character)
it "should fetch unblocked urls" do
visit('/')
driver.within_frame('frame3') do
- driver.find_xpath("//p").first.visible_text.should == "Inner"
+ driver.find_xpath("//p").first.visible_text.should eq "Inner"
end
end
it "returns a status code for blocked urls" do
visit("/")
driver.within_frame('frame1') do
- driver.status_code.should == 200
+ driver.status_code.should eq 200
end
end
end
@@ -2223,7 +2223,7 @@ def which_for(character)
it "should raise a timeout on a slow form" do
driver.browser.timeout = 3
visit("/")
- driver.status_code.should == 200
+ driver.status_code.should eq 200
driver.browser.timeout = 1
driver.find_xpath("//input").first.click
lambda { driver.status_code }.should raise_error(Timeout::Error)
@@ -2231,9 +2231,9 @@ def which_for(character)
it "get timeout" do
driver.browser.timeout = 10
- driver.browser.timeout.should == 10
+ driver.browser.timeout.should eq 10
driver.browser.timeout = 3
- driver.browser.timeout.should == 3
+ driver.browser.timeout.should eq 3
end
end
@@ -2299,7 +2299,7 @@ def log
it 'should not hang the server' do
visit('/')
driver.find_xpath('//input').first.click
- driver.console_messages.first[:message].should == "hello"
+ driver.console_messages.first[:message].should eq "hello"
end
end
@@ -2318,7 +2318,7 @@ def log
it 'returns an xpath for the current node' do
visit('/')
path = driver.find_xpath('//span').first.path
- driver.find_xpath(path).first.text.should == 'hello'
+ driver.find_xpath(path).first.text.should eq 'hello'
end
end
View
20 spec/integration/session_spec.rb
@@ -117,26 +117,26 @@ module TestSessions
it "should get status code" do
subject.visit '/'
- subject.status_code.should == 200
+ subject.status_code.should eq 200
end
it "should reset status code" do
subject.visit '/'
- subject.status_code.should == 200
+ subject.status_code.should eq 200
subject.reset!
- subject.status_code.should == 0
+ subject.status_code.should eq 0
end
it "should get response headers" do
subject.visit '/'
- subject.response_headers['X-Capybara'].should == 'WebKit'
+ subject.response_headers['X-Capybara'].should eq 'WebKit'
end
it "should reset response headers" do
subject.visit '/'
- subject.response_headers['X-Capybara'].should == 'WebKit'
+ subject.response_headers['X-Capybara'].should eq 'WebKit'
subject.reset!
- subject.response_headers['X-Capybara'].should == nil
+ subject.response_headers['X-Capybara'].should eq nil
end
end
@@ -377,16 +377,16 @@ module TestSessions
it 'clicks in the center of an element' do
subject.visit('/')
subject.find(:css, '#one').click
- subject.find(:css, '#one')['data-click-x'].should == '199'
- subject.find(:css, '#one')['data-click-y'].should == '199'
+ subject.find(:css, '#one')['data-click-x'].should eq '199'
+ subject.find(:css, '#one')['data-click-y'].should eq '199'
end
it 'clicks in the center of the viewable area of an element' do
subject.visit('/')
subject.driver.resize_window(200, 200)
subject.find(:css, '#one').click
- subject.find(:css, '#one')['data-click-x'].should == '149'
- subject.find(:css, '#one')['data-click-y'].should == '99'
+ subject.find(:css, '#one')['data-click-x'].should eq '149'
+ subject.find(:css, '#one')['data-click-y'].should eq '99'
end
it 'does not raise an error when an anchor contains empty nodes' do
Please sign in to comment.
Something went wrong with that request. Please try again.