1
0
Fork 0
mirror of https://github.com/teampoltergeist/poltergeist.git synced 2022-11-09 12:05:00 -05:00

Remove all of the shoulds

This commit is contained in:
Tom Stuart 2012-06-04 14:21:09 +02:00
parent 37f9fcd805
commit 96ab96a494
4 changed files with 29 additions and 29 deletions

View file

@ -14,7 +14,7 @@ module Capybara::Poltergeist
it_should_behave_like "driver without status code support"
it_should_behave_like "driver with cookies support"
it 'should support a custom phantomjs path' do
it 'supports a custom phantomjs path' do
file = POLTERGEIST_ROOT + '/spec/support/custom_phantomjs_called'
path = POLTERGEIST_ROOT + '/spec/support/custom_phantomjs'
@ -35,18 +35,18 @@ module Capybara::Poltergeist
File.exist?(file).should == true
end
it 'should raise an error and restart the client, if the client dies while executing a command' do
it 'raises an error and restart the client, if the client dies while executing a command' do
lambda { @driver.browser.command('exit') }.should raise_error(DeadClient)
@driver.visit('/')
@driver.body.should include('Hello world')
end
it 'should have a viewport size of 1024x768 by default' do
it 'has a viewport size of 1024x768 by default' do
@driver.visit('/')
@driver.evaluate_script('[window.innerWidth, window.innerHeight]').should == [1024, 768]
end
it 'should allow the viewport to be resized' do
it 'allows the viewport to be resized' do
begin
@driver.visit('/')
@driver.resize(200, 400)
@ -56,7 +56,7 @@ module Capybara::Poltergeist
end
end
it 'should support rendering the page' do
it 'supports rendering the page' do
file = POLTERGEIST_ROOT + '/spec/tmp/screenshot.png'
FileUtils.rm_f file
@driver.visit('/')
@ -64,7 +64,7 @@ module Capybara::Poltergeist
File.exist?(file).should == true
end
it 'should support rendering the whole of a page that goes outside the viewport' do
it 'supports rendering the whole of a page that goes outside the viewport' do
file = POLTERGEIST_ROOT + '/spec/tmp/screenshot.png'
@driver.visit('/poltergeist/long_page')
@driver.render(file)
@ -82,7 +82,7 @@ module Capybara::Poltergeist
end
end
it 'should support executing multiple lines of javascript' do
it 'supports executing multiple lines of javascript' do
@driver.execute_script <<-JS
var a = 1
var b = 2
@ -91,7 +91,7 @@ module Capybara::Poltergeist
@driver.evaluate_script("result").should == 3
end
it 'should operate a timeout when communicating with phantomjs' do
it 'operates a timeout when communicating with phantomjs' do
begin
prev_timeout = @driver.timeout
@driver.timeout = 0.001

View file

@ -13,7 +13,7 @@ describe Capybara::Session do
it_should_behave_like "session without status code support"
describe Capybara::Poltergeist::Node do
it 'should raise an error if the element has been removed from the DOM' do
it 'raises an error if the element has been removed from the DOM' do
@session.visit('/poltergeist/with_js')
node = @session.find(:css, '#remove_me')
node.text.should == 'Remove me'
@ -21,7 +21,7 @@ describe Capybara::Session do
lambda { node.text }.should raise_error(Capybara::Poltergeist::ObsoleteNode)
end
it 'should raise an error if the element was on a previous page' do
it 'raises an error if the element was on a previous page' do
@session.visit('/poltergeist/index')
node = @session.find('.//a')
@session.execute_script "window.location = 'about:blank'"
@ -51,38 +51,38 @@ describe Capybara::Session do
@session.find(:css, '#change_me').set("Hello!")
end
it 'should fire the change event' do
it 'fires the change event' do
@session.find(:css, '#changes').text.should == "Hello!"
end
it 'should accept numbers in a maxlength field' do
it 'accepts numbers in a maxlength field' do
element = @session.find(:css, '#change_me_maxlength')
element.set 100
element.value.should == '100'
end
it 'should fire the keydown event' do
it 'fires the keydown event' do
@session.find(:css, '#changes_on_keydown').text.should == "6"
end
it 'should fire the keyup event' do
it 'fires the keyup event' do
@session.find(:css, '#changes_on_keyup').text.should == "6"
end
it 'should fire the keypress event' do
it 'fires the keypress event' do
@session.find(:css, '#changes_on_keypress').text.should == "6"
end
it 'should fire the focus event' do
it 'fires the focus event' do
@session.find(:css, '#changes_on_focus').text.should == "Focus"
end
it 'should fire the blur event' do
it 'fires the blur event' do
@session.find(:css, '#changes_on_blur').text.should == "Blur"
end
end
it 'should support running multiple sessions at once' do
it 'supports running multiple sessions at once' do
other_session = Capybara::Session.new(:poltergeist, TestApp)
@session.visit('/')
@ -92,7 +92,7 @@ describe Capybara::Session do
other_session.should have_content("Hello")
end
it 'should not have trouble clicking elements when the size of a document changes' do
it 'has no trouble clicking elements when the size of a document changes' do
@session.visit('/poltergeist/long_page')
@session.find(:css, '#penultimate').click
@session.execute_script <<-JS
@ -103,30 +103,30 @@ describe Capybara::Session do
@session.should have_content("Hello")
end
it 'should handle clicks where the target is in view, but the document is smaller than the viewport' do
it 'handles clicks where the target is in view, but the document is smaller than the viewport' do
@session.visit '/poltergeist/simple'
@session.click_link 'Link'
@session.should have_content('Hello world')
end
it 'should handle clicks where a parent element has a border' do
it 'handles clicks where a parent element has a border' do
@session.visit '/poltergeist/table'
@session.click_link 'Link'
@session.should have_content('Hello world')
end
it 'should handle window.confirm(), returning true unconditionally' do
it 'handles window.confirm(), returning true unconditionally' do
@session.visit '/'
@session.evaluate_script("window.confirm('foo')").should == true
end
it 'should handle window.prompt(), returning the default value or null' do
it 'handles window.prompt(), returning the default value or null' do
@session.visit '/'
@session.evaluate_script("window.prompt()").should == nil
@session.evaluate_script("window.prompt('foo', 'default')").should == 'default'
end
it 'should handle evaluate_script values properly' do
it 'handles evaluate_script values properly' do
@session.evaluate_script('null').should == nil
@session.evaluate_script('false').should == false
@session.evaluate_script('true').should == true
@ -149,7 +149,7 @@ describe Capybara::Session do
@session.driver.resize(1024, 768)
end
it 'should scroll around so that elements can be clicked' do
it 'scrolls around so that elements can be clicked' do
@session.driver.resize(200, 200)
log = @session.find(:css, '#log')

View file

@ -10,7 +10,7 @@ module Capybara::Poltergeist
let(:logger) { StringIO.new }
subject { Browser.new(server, client, logger) }
it 'should log requests and responses to the client' do
it 'logs requests and responses to the client' do
request = { 'name' => 'where is', 'args' => ["the love?"] }
response = { 'response' => '<3' }
server.stub(:send).with(MultiJson.dump(request)).and_return(MultiJson.dump(response))

View file

@ -5,7 +5,7 @@ module Capybara::Poltergeist
context 'with no options' do
subject { Driver.new(nil) }
it 'should not log' do
it 'does not log' do
subject.logger.should == nil
end
@ -17,7 +17,7 @@ module Capybara::Poltergeist
context 'with a :logger option' do
subject { Driver.new(nil, :logger => :my_custom_logger) }
it 'should log to the logger given' do
it 'logs to the logger given' do
subject.logger.should == :my_custom_logger
end
end
@ -25,7 +25,7 @@ module Capybara::Poltergeist
context 'with a :debug => true option' do
subject { Driver.new(nil, :debug => true) }
it 'should log to STDERR' do
it 'logs to STDERR' do
subject.logger.should == STDERR
end
end