Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use @session to remove duplication from DSL specs.

  • Loading branch information...
commit 8d9082a91559a8643dd85ea58dd0e23321cd0850 1 parent b6e68c5
@randycoulman randycoulman authored
Showing with 8 additions and 24 deletions.
  1. +8 −24 spec/dsl_spec.rb
View
32 spec/dsl_spec.rb
@@ -229,41 +229,25 @@ class TestClass
end
it "should be possible to include it in another class" do
- klass = Class.new do
- include Capybara::DSL
- end
- foo = klass.new
- foo.visit('/with_html')
- foo.click_link('ullamco')
- foo.body.should include('Another World')
+ @session.visit('/with_html')
+ @session.click_link('ullamco')
+ @session.body.should include('Another World')
end
it "should provide a 'page' shortcut for more expressive tests" do
- klass = Class.new do
- include Capybara::DSL
- end
- foo = klass.new
- foo.page.visit('/with_html')
- foo.page.click_link('ullamco')
- foo.page.body.should include('Another World')
+ @session.page.visit('/with_html')
+ @session.page.click_link('ullamco')
+ @session.page.body.should include('Another World')
end
it "should provide an 'using_session' shortcut" do
- klass = Class.new do
- include Capybara::DSL
- end
Capybara.should_receive(:using_session).with(:name)
- foo = klass.new
- foo.using_session(:name)
+ @session.using_session(:name)
end
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)
- foo = klass.new
- foo.using_wait_time(6)
+ @session.using_wait_time(6)
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.