mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Test with some simple html for #body
This commit is contained in:
parent
0b379be094
commit
c4ee7eaa69
5 changed files with 33 additions and 13 deletions
|
@ -28,7 +28,7 @@ class Webcat::Driver::Culerity
|
|||
end
|
||||
|
||||
def body
|
||||
browser.text
|
||||
browser.html
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -2,8 +2,8 @@ require File.expand_path('spec_helper', File.dirname(__FILE__))
|
|||
|
||||
shared_examples_for 'driver' do
|
||||
|
||||
describe '#get' do
|
||||
it "should fetch a response" do
|
||||
describe '#visit' do
|
||||
it "should move to another page" do
|
||||
@driver.visit('/')
|
||||
@driver.body.should == 'Hello world!'
|
||||
@driver.visit('/foo')
|
||||
|
@ -11,4 +11,16 @@ shared_examples_for 'driver' do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#body' do
|
||||
it "should return text reponses" do
|
||||
@driver.visit('/')
|
||||
@driver.body.should == 'Hello world!'
|
||||
end
|
||||
|
||||
it "should return the full response html" do
|
||||
@driver.visit('/with_simple_html')
|
||||
@driver.body.should == '<h1>Bar</h1>'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,18 +1,10 @@
|
|||
$:.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
|
||||
$:.unshift(File.dirname(__FILE__))
|
||||
|
||||
require 'rubygems'
|
||||
require 'webcat'
|
||||
require 'sinatra/base'
|
||||
require 'rack'
|
||||
require 'test_app'
|
||||
|
||||
alias :running :lambda
|
||||
|
||||
class TestApp < Sinatra::Base
|
||||
get '/' do
|
||||
'Hello world!'
|
||||
end
|
||||
|
||||
get '/foo' do
|
||||
'Another World'
|
||||
end
|
||||
end
|
||||
|
|
15
spec/test_app.rb
Normal file
15
spec/test_app.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
class TestApp < Sinatra::Base
|
||||
set :views, File.dirname(__FILE__) + '/views'
|
||||
|
||||
get '/' do
|
||||
'Hello world!'
|
||||
end
|
||||
|
||||
get '/foo' do
|
||||
'Another World'
|
||||
end
|
||||
|
||||
get '/with_simple_html' do
|
||||
erb :with_simple_html
|
||||
end
|
||||
end
|
1
spec/views/with_simple_html.erb
Normal file
1
spec/views/with_simple_html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<h1>Bar</h1>
|
Loading…
Reference in a new issue