mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Merge pull request #913 from randycoulman/dsl-spec-cleanup
Use @session to remove duplication from DSL specs.
This commit is contained in:
commit
4be50fab61
1 changed files with 8 additions and 24 deletions
|
@ -229,41 +229,25 @@ describe Capybara::DSL do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should be possible to include it in another class" do
|
it "should be possible to include it in another class" do
|
||||||
klass = Class.new do
|
@session.visit('/with_html')
|
||||||
include Capybara::DSL
|
@session.click_link('ullamco')
|
||||||
end
|
@session.body.should include('Another World')
|
||||||
foo = klass.new
|
|
||||||
foo.visit('/with_html')
|
|
||||||
foo.click_link('ullamco')
|
|
||||||
foo.body.should include('Another World')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should provide a 'page' shortcut for more expressive tests" do
|
it "should provide a 'page' shortcut for more expressive tests" do
|
||||||
klass = Class.new do
|
@session.page.visit('/with_html')
|
||||||
include Capybara::DSL
|
@session.page.click_link('ullamco')
|
||||||
end
|
@session.page.body.should include('Another World')
|
||||||
foo = klass.new
|
|
||||||
foo.page.visit('/with_html')
|
|
||||||
foo.page.click_link('ullamco')
|
|
||||||
foo.page.body.should include('Another World')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should provide an 'using_session' shortcut" do
|
it "should provide an 'using_session' shortcut" do
|
||||||
klass = Class.new do
|
|
||||||
include Capybara::DSL
|
|
||||||
end
|
|
||||||
Capybara.should_receive(:using_session).with(:name)
|
Capybara.should_receive(:using_session).with(:name)
|
||||||
foo = klass.new
|
@session.using_session(:name)
|
||||||
foo.using_session(:name)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should provide a 'using_wait_time' shortcut" do
|
it "should provide a 'using_wait_time' shortcut" do
|
||||||
klass = Class.new do
|
|
||||||
include Capybara::DSL
|
|
||||||
end
|
|
||||||
Capybara.should_receive(:using_wait_time).with(6)
|
Capybara.should_receive(:using_wait_time).with(6)
|
||||||
foo = klass.new
|
@session.using_wait_time(6)
|
||||||
foo.using_wait_time(6)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue