nimboids-capybara 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +289 -0
- data/README.rdoc +722 -0
- data/lib/capybara.rb +252 -0
- data/lib/capybara/cucumber.rb +28 -0
- data/lib/capybara/driver/base.rb +64 -0
- data/lib/capybara/driver/node.rb +74 -0
- data/lib/capybara/dsl.rb +168 -0
- data/lib/capybara/node/actions.rb +162 -0
- data/lib/capybara/node/base.rb +63 -0
- data/lib/capybara/node/document.rb +25 -0
- data/lib/capybara/node/element.rb +201 -0
- data/lib/capybara/node/finders.rb +197 -0
- data/lib/capybara/node/matchers.rb +417 -0
- data/lib/capybara/node/simple.rb +132 -0
- data/lib/capybara/rack_test/browser.rb +121 -0
- data/lib/capybara/rack_test/driver.rb +80 -0
- data/lib/capybara/rack_test/form.rb +80 -0
- data/lib/capybara/rack_test/node.rb +105 -0
- data/lib/capybara/rails.rb +17 -0
- data/lib/capybara/rspec.rb +26 -0
- data/lib/capybara/rspec/features.rb +22 -0
- data/lib/capybara/rspec/matchers.rb +154 -0
- data/lib/capybara/selector.rb +89 -0
- data/lib/capybara/selenium/driver.rb +163 -0
- data/lib/capybara/selenium/node.rb +91 -0
- data/lib/capybara/server.rb +90 -0
- data/lib/capybara/session.rb +321 -0
- data/lib/capybara/spec/driver.rb +301 -0
- data/lib/capybara/spec/fixtures/capybara.jpg +3 -0
- data/lib/capybara/spec/fixtures/test_file.txt +1 -0
- data/lib/capybara/spec/public/test.js +43 -0
- data/lib/capybara/spec/session.rb +154 -0
- data/lib/capybara/spec/session/all_spec.rb +78 -0
- data/lib/capybara/spec/session/attach_file_spec.rb +73 -0
- data/lib/capybara/spec/session/check_spec.rb +65 -0
- data/lib/capybara/spec/session/choose_spec.rb +26 -0
- data/lib/capybara/spec/session/click_button_spec.rb +304 -0
- data/lib/capybara/spec/session/click_link_or_button_spec.rb +36 -0
- data/lib/capybara/spec/session/click_link_spec.rb +119 -0
- data/lib/capybara/spec/session/current_host_spec.rb +68 -0
- data/lib/capybara/spec/session/current_url_spec.rb +15 -0
- data/lib/capybara/spec/session/fill_in_spec.rb +125 -0
- data/lib/capybara/spec/session/find_button_spec.rb +18 -0
- data/lib/capybara/spec/session/find_by_id_spec.rb +18 -0
- data/lib/capybara/spec/session/find_field_spec.rb +26 -0
- data/lib/capybara/spec/session/find_link_spec.rb +19 -0
- data/lib/capybara/spec/session/find_spec.rb +149 -0
- data/lib/capybara/spec/session/first_spec.rb +105 -0
- data/lib/capybara/spec/session/has_button_spec.rb +32 -0
- data/lib/capybara/spec/session/has_content_spec.rb +106 -0
- data/lib/capybara/spec/session/has_css_spec.rb +243 -0
- data/lib/capybara/spec/session/has_field_spec.rb +192 -0
- data/lib/capybara/spec/session/has_link_spec.rb +37 -0
- data/lib/capybara/spec/session/has_select_spec.rb +129 -0
- data/lib/capybara/spec/session/has_selector_spec.rb +129 -0
- data/lib/capybara/spec/session/has_table_spec.rb +96 -0
- data/lib/capybara/spec/session/has_xpath_spec.rb +123 -0
- data/lib/capybara/spec/session/headers.rb +19 -0
- data/lib/capybara/spec/session/javascript.rb +289 -0
- data/lib/capybara/spec/session/response_code.rb +19 -0
- data/lib/capybara/spec/session/select_spec.rb +113 -0
- data/lib/capybara/spec/session/text_spec.rb +19 -0
- data/lib/capybara/spec/session/uncheck_spec.rb +21 -0
- data/lib/capybara/spec/session/unselect_spec.rb +61 -0
- data/lib/capybara/spec/session/within_spec.rb +178 -0
- data/lib/capybara/spec/test_app.rb +142 -0
- data/lib/capybara/spec/views/buttons.erb +4 -0
- data/lib/capybara/spec/views/fieldsets.erb +29 -0
- data/lib/capybara/spec/views/form.erb +365 -0
- data/lib/capybara/spec/views/frame_one.erb +8 -0
- data/lib/capybara/spec/views/frame_two.erb +8 -0
- data/lib/capybara/spec/views/header_links.erb +7 -0
- data/lib/capybara/spec/views/host_links.erb +12 -0
- data/lib/capybara/spec/views/popup_one.erb +8 -0
- data/lib/capybara/spec/views/popup_two.erb +8 -0
- data/lib/capybara/spec/views/postback.erb +13 -0
- data/lib/capybara/spec/views/tables.erb +122 -0
- data/lib/capybara/spec/views/with_html.erb +78 -0
- data/lib/capybara/spec/views/with_html_entities.erb +1 -0
- data/lib/capybara/spec/views/with_js.erb +48 -0
- data/lib/capybara/spec/views/with_scope.erb +36 -0
- data/lib/capybara/spec/views/with_simple_html.erb +1 -0
- data/lib/capybara/spec/views/within_frames.erb +10 -0
- data/lib/capybara/spec/views/within_popups.erb +25 -0
- data/lib/capybara/util/save_and_open_page.rb +44 -0
- data/lib/capybara/util/timeout.rb +27 -0
- data/lib/capybara/version.rb +3 -0
- data/spec/basic_node_spec.rb +77 -0
- data/spec/capybara_spec.rb +46 -0
- data/spec/driver/rack_test_driver_spec.rb +89 -0
- data/spec/driver/selenium_driver_spec.rb +50 -0
- data/spec/dsl_spec.rb +253 -0
- data/spec/fixtures/selenium_driver_rspec_failure.rb +8 -0
- data/spec/fixtures/selenium_driver_rspec_success.rb +8 -0
- data/spec/rspec/features_spec.rb +45 -0
- data/spec/rspec/matchers_spec.rb +495 -0
- data/spec/rspec_spec.rb +53 -0
- data/spec/save_and_open_page_spec.rb +155 -0
- data/spec/server_spec.rb +89 -0
- data/spec/session/rack_test_session_spec.rb +55 -0
- data/spec/session/selenium_session_spec.rb +26 -0
- data/spec/spec_helper.rb +30 -0
- data/spec/string_spec.rb +77 -0
- data/spec/timeout_spec.rb +28 -0
- metadata +346 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Capybara do
|
4
|
+
|
5
|
+
describe 'default_wait_time' do
|
6
|
+
after do
|
7
|
+
Capybara.default_wait_time = @previous_default_time
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be changeable" do
|
11
|
+
@previous_default_time = Capybara.default_wait_time
|
12
|
+
Capybara.default_wait_time = 5
|
13
|
+
Capybara.default_wait_time.should == 5
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '.register_driver' do
|
18
|
+
it "should add a new driver" do
|
19
|
+
Capybara.register_driver :schmoo do |app|
|
20
|
+
Capybara::RackTest::Driver.new(app)
|
21
|
+
end
|
22
|
+
session = Capybara::Session.new(:schmoo, TestApp)
|
23
|
+
session.visit('/')
|
24
|
+
session.body.should include("Hello world!")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe ".server" do
|
29
|
+
after do
|
30
|
+
Capybara.server {|app, port| Capybara.run_default_server(app, port)}
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should default to a proc that calls run_default_server" do
|
34
|
+
mock_app = mock('app')
|
35
|
+
Capybara.should_receive(:run_default_server).with(mock_app, 8000)
|
36
|
+
Capybara.server.call(mock_app, 8000)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should return a custom server proc" do
|
40
|
+
server = lambda {|app, port|}
|
41
|
+
Capybara.server(&server)
|
42
|
+
Capybara.server.should == server
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
def capture(*streams)
|
6
|
+
streams.map! { |stream| stream.to_s }
|
7
|
+
begin
|
8
|
+
result = StringIO.new
|
9
|
+
streams.each { |stream| eval "$#{stream} = result" }
|
10
|
+
yield
|
11
|
+
ensure
|
12
|
+
streams.each { |stream| eval("$#{stream} = #{stream.upcase}") }
|
13
|
+
end
|
14
|
+
result.string
|
15
|
+
end
|
16
|
+
|
17
|
+
describe Capybara::RackTest::Driver do
|
18
|
+
before do
|
19
|
+
@driver = TestSessions::RackTest.driver
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should throw an error when no rack app is given" do
|
23
|
+
running do
|
24
|
+
Capybara::RackTest::Driver.new(nil)
|
25
|
+
end.should raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
|
28
|
+
it_should_behave_like "driver"
|
29
|
+
it_should_behave_like "driver with header support"
|
30
|
+
it_should_behave_like "driver with status code support"
|
31
|
+
it_should_behave_like "driver with cookies support"
|
32
|
+
it_should_behave_like "driver with infinite redirect detection"
|
33
|
+
|
34
|
+
describe '#reset!' do
|
35
|
+
it { @driver.visit('/foo'); lambda { @driver.reset! }.should change(@driver, :current_url).to('') }
|
36
|
+
|
37
|
+
it 'should reset headers' do
|
38
|
+
@driver.header('FOO', 'BAR')
|
39
|
+
@driver.visit('/get_header')
|
40
|
+
@driver.body.should include('BAR')
|
41
|
+
|
42
|
+
@driver.reset!
|
43
|
+
@driver.visit('/get_header')
|
44
|
+
@driver.body.should_not include('BAR')
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should reset response' do
|
48
|
+
@driver.visit('/foo')
|
49
|
+
lambda { @driver.response }.should_not raise_error
|
50
|
+
@driver.reset!
|
51
|
+
lambda { @driver.response }.should raise_error
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should request response' do
|
55
|
+
@driver.visit('/foo')
|
56
|
+
lambda { @driver.request }.should_not raise_error
|
57
|
+
@driver.reset!
|
58
|
+
lambda { @driver.request }.should raise_error
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe ':headers option' do
|
63
|
+
it 'should always set headers' do
|
64
|
+
@driver = Capybara::RackTest::Driver.new(TestApp, :headers => {'HTTP_FOO' => 'foobar'})
|
65
|
+
@driver.visit('/get_header')
|
66
|
+
@driver.body.should include('foobar')
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should keep headers on link clicks' do
|
70
|
+
@driver = Capybara::RackTest::Driver.new(TestApp, :headers => {'HTTP_FOO' => 'foobar'})
|
71
|
+
@driver.visit('/header_links')
|
72
|
+
@driver.find('.//a').first.click
|
73
|
+
@driver.body.should include('foobar')
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should keep headers on form submit' do
|
77
|
+
@driver = Capybara::RackTest::Driver.new(TestApp, :headers => {'HTTP_FOO' => 'foobar'})
|
78
|
+
@driver.visit('/header_links')
|
79
|
+
@driver.find('.//input').first.click
|
80
|
+
@driver.body.should include('foobar')
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should keep headers on redirects' do
|
84
|
+
@driver = Capybara::RackTest::Driver.new(TestApp, :headers => {'HTTP_FOO' => 'foobar'})
|
85
|
+
@driver.visit('/get_header_via_redirect')
|
86
|
+
@driver.body.should include('foobar')
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rbconfig'
|
3
|
+
|
4
|
+
describe Capybara::Selenium::Driver do
|
5
|
+
before do
|
6
|
+
@driver = TestSessions::Selenium.driver
|
7
|
+
end
|
8
|
+
|
9
|
+
it_should_behave_like "driver"
|
10
|
+
it_should_behave_like "driver with javascript support"
|
11
|
+
it_should_behave_like "driver with resynchronization support"
|
12
|
+
it_should_behave_like "driver with frame support"
|
13
|
+
it_should_behave_like "driver with support for window switching"
|
14
|
+
it_should_behave_like "driver without status code support"
|
15
|
+
it_should_behave_like "driver with cookies support"
|
16
|
+
|
17
|
+
unless Config::CONFIG['host_os'] =~ /mswin|mingw/
|
18
|
+
it "should not interfere with forking child processes" do
|
19
|
+
# Launch a browser, which registers the at_exit hook
|
20
|
+
browser = Capybara::Selenium::Driver.new(TestApp).browser
|
21
|
+
|
22
|
+
# Fork an unrelated child process. This should not run the code in the at_exit hook.
|
23
|
+
pid = fork { "child" }
|
24
|
+
Process.wait2(pid)[1].exitstatus.should == 0
|
25
|
+
|
26
|
+
browser.quit
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "exit codes" do
|
31
|
+
before do
|
32
|
+
@current_dir = Dir.getwd
|
33
|
+
Dir.chdir(File.join(File.dirname(__FILE__), '..', '..'))
|
34
|
+
end
|
35
|
+
|
36
|
+
after do
|
37
|
+
Dir.chdir(@current_dir)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should have return code 1 when running selenium_driver_rspec_failure.rb" do
|
41
|
+
`rspec spec/fixtures/selenium_driver_rspec_failure.rb`
|
42
|
+
$?.exitstatus.should be 1
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should have return code 0 when running selenium_driver_rspec_success.rb" do
|
46
|
+
`rspec spec/fixtures/selenium_driver_rspec_success.rb`
|
47
|
+
$?.exitstatus.should be 0
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/spec/dsl_spec.rb
ADDED
@@ -0,0 +1,253 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'capybara/dsl'
|
4
|
+
|
5
|
+
describe Capybara::DSL do
|
6
|
+
|
7
|
+
before do
|
8
|
+
Capybara.app = TestApp
|
9
|
+
end
|
10
|
+
|
11
|
+
after do
|
12
|
+
Capybara.session_name = nil
|
13
|
+
Capybara.default_driver = nil
|
14
|
+
Capybara.use_default_driver
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#default_driver' do
|
18
|
+
it "should default to rack_test" do
|
19
|
+
Capybara.default_driver.should == :rack_test
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should be changeable" do
|
23
|
+
Capybara.default_driver = :culerity
|
24
|
+
Capybara.default_driver.should == :culerity
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#current_driver' do
|
29
|
+
it "should default to the default driver" do
|
30
|
+
Capybara.current_driver.should == :rack_test
|
31
|
+
Capybara.default_driver = :culerity
|
32
|
+
Capybara.current_driver.should == :culerity
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should be changeable" do
|
36
|
+
Capybara.current_driver = :culerity
|
37
|
+
Capybara.current_driver.should == :culerity
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#javascript_driver' do
|
42
|
+
it "should default to selenium" do
|
43
|
+
Capybara.javascript_driver.should == :selenium
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should be changeable" do
|
47
|
+
Capybara.javascript_driver = :culerity
|
48
|
+
Capybara.javascript_driver.should == :culerity
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#use_default_driver' do
|
53
|
+
it "should restore the default driver" do
|
54
|
+
Capybara.current_driver = :culerity
|
55
|
+
Capybara.use_default_driver
|
56
|
+
Capybara.current_driver.should == :rack_test
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#using_driver' do
|
61
|
+
before do
|
62
|
+
Capybara.current_driver.should_not == :selenium
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should set the driver using Capybara.current_driver=' do
|
66
|
+
driver = nil
|
67
|
+
Capybara.using_driver(:selenium) { driver = Capybara.current_driver }
|
68
|
+
driver.should == :selenium
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should reset the driver using Capybara.use_default_driver, even if an exception occurs' do
|
72
|
+
begin
|
73
|
+
Capybara.using_driver(:selenium) { raise "ohnoes!" }
|
74
|
+
rescue Exception
|
75
|
+
end
|
76
|
+
Capybara.current_driver.should == Capybara.default_driver
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should return the driver to what it was previously' do
|
80
|
+
Capybara.current_driver = :selenium
|
81
|
+
Capybara.using_driver(:culerity) do
|
82
|
+
Capybara.using_driver(:rack_test) do
|
83
|
+
Capybara.current_driver.should == :rack_test
|
84
|
+
end
|
85
|
+
Capybara.current_driver.should == :culerity
|
86
|
+
end
|
87
|
+
Capybara.current_driver.should == :selenium
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'should yield the passed block' do
|
91
|
+
called = false
|
92
|
+
Capybara.using_driver(:selenium) { called = true }
|
93
|
+
called.should == true
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe '#using_wait_time' do
|
98
|
+
it "should switch the wait time and switch it back" do
|
99
|
+
in_block = nil
|
100
|
+
Capybara.using_wait_time 6 do
|
101
|
+
in_block = Capybara.default_wait_time
|
102
|
+
end
|
103
|
+
in_block.should == 6
|
104
|
+
Capybara.default_wait_time.should == 0
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should ensure wait time is reset" do
|
108
|
+
expect do
|
109
|
+
Capybara.using_wait_time 6 do
|
110
|
+
raise "hell"
|
111
|
+
end
|
112
|
+
end.to raise_error
|
113
|
+
Capybara.default_wait_time.should == 0
|
114
|
+
end
|
115
|
+
|
116
|
+
after do
|
117
|
+
Capybara.default_wait_time = 0
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe '#app' do
|
122
|
+
it "should be changeable" do
|
123
|
+
Capybara.app = "foobar"
|
124
|
+
Capybara.app.should == 'foobar'
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '#current_session' do
|
129
|
+
it "should choose a session object of the current driver type" do
|
130
|
+
Capybara.current_session.should be_a(Capybara::Session)
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should use #app as the application" do
|
134
|
+
Capybara.app = proc {}
|
135
|
+
Capybara.current_session.app.should == Capybara.app
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should change with the current driver" do
|
139
|
+
Capybara.current_session.mode.should == :rack_test
|
140
|
+
Capybara.current_driver = :selenium
|
141
|
+
Capybara.current_session.mode.should == :selenium
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should be persistent even across driver changes" do
|
145
|
+
object_id = Capybara.current_session.object_id
|
146
|
+
Capybara.current_session.object_id.should == object_id
|
147
|
+
Capybara.current_driver = :selenium
|
148
|
+
Capybara.current_session.mode.should == :selenium
|
149
|
+
Capybara.current_session.object_id.should_not == object_id
|
150
|
+
|
151
|
+
Capybara.current_driver = :rack_test
|
152
|
+
Capybara.current_session.object_id.should == object_id
|
153
|
+
end
|
154
|
+
|
155
|
+
it "should change when changing application" do
|
156
|
+
object_id = Capybara.current_session.object_id
|
157
|
+
Capybara.current_session.object_id.should == object_id
|
158
|
+
Capybara.app = proc {}
|
159
|
+
Capybara.current_session.object_id.should_not == object_id
|
160
|
+
Capybara.current_session.app.should == Capybara.app
|
161
|
+
end
|
162
|
+
|
163
|
+
it "should change when the session name changes" do
|
164
|
+
object_id = Capybara.current_session.object_id
|
165
|
+
Capybara.session_name = :administrator
|
166
|
+
Capybara.session_name.should == :administrator
|
167
|
+
Capybara.current_session.object_id.should_not == object_id
|
168
|
+
Capybara.session_name = :default
|
169
|
+
Capybara.session_name.should == :default
|
170
|
+
Capybara.current_session.object_id.should == object_id
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
describe "#using_session" do
|
175
|
+
it "should change the session name for the duration of the block" do
|
176
|
+
Capybara.session_name.should == :default
|
177
|
+
Capybara.using_session(:administrator) do
|
178
|
+
Capybara.session_name.should == :administrator
|
179
|
+
end
|
180
|
+
Capybara.session_name.should == :default
|
181
|
+
end
|
182
|
+
|
183
|
+
it "should reset the session to the default, even if an exception occurs" do
|
184
|
+
begin
|
185
|
+
Capybara.using_session(:raise) do
|
186
|
+
raise
|
187
|
+
end
|
188
|
+
rescue Exception
|
189
|
+
end
|
190
|
+
Capybara.session_name.should == :default
|
191
|
+
end
|
192
|
+
|
193
|
+
it "should yield the passed block" do
|
194
|
+
called = false
|
195
|
+
Capybara.using_session(:administrator) { called = true }
|
196
|
+
called.should == true
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
describe "#session_name" do
|
201
|
+
it "should default to :default" do
|
202
|
+
Capybara.session_name.should == :default
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
describe 'the DSL' do
|
207
|
+
before do
|
208
|
+
@session = Class.new { include Capybara::DSL }.new
|
209
|
+
end
|
210
|
+
|
211
|
+
it_should_behave_like "session"
|
212
|
+
it_should_behave_like "session without javascript support"
|
213
|
+
|
214
|
+
it "should be possible to include it in another class" do
|
215
|
+
klass = Class.new do
|
216
|
+
include Capybara::DSL
|
217
|
+
end
|
218
|
+
foo = klass.new
|
219
|
+
foo.visit('/with_html')
|
220
|
+
foo.click_link('ullamco')
|
221
|
+
foo.body.should include('Another World')
|
222
|
+
end
|
223
|
+
|
224
|
+
it "should provide a 'page' shortcut for more expressive tests" do
|
225
|
+
klass = Class.new do
|
226
|
+
include Capybara::DSL
|
227
|
+
end
|
228
|
+
foo = klass.new
|
229
|
+
foo.page.visit('/with_html')
|
230
|
+
foo.page.click_link('ullamco')
|
231
|
+
foo.page.body.should include('Another World')
|
232
|
+
end
|
233
|
+
|
234
|
+
it "should provide an 'using_session' shortcut" do
|
235
|
+
klass = Class.new do
|
236
|
+
include Capybara::DSL
|
237
|
+
end
|
238
|
+
Capybara.should_receive(:using_session).with(:name)
|
239
|
+
foo = klass.new
|
240
|
+
foo.using_session(:name)
|
241
|
+
end
|
242
|
+
|
243
|
+
it "should provide a 'using_wait_time' shortcut" do
|
244
|
+
klass = Class.new do
|
245
|
+
include Capybara::DSL
|
246
|
+
end
|
247
|
+
Capybara.should_receive(:using_wait_time).with(6)
|
248
|
+
foo = klass.new
|
249
|
+
foo.using_wait_time(6)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
end
|