spec/integration/napybara_spec.rb in napybara-0.2.0 vs spec/integration/napybara_spec.rb in napybara-0.3.0
- old
+ new
@@ -1,46 +1,44 @@
require 'capybara/poltergeist'
require 'spec_helper'
require 'dummy_app/dummy_app'
-describe Napybara do
+describe 'Napybara::Element#get' do
describe '#has_content?' do
describe 'waits for Ajax events to complete before processing' do
let(:session) do
Capybara::Session.new(:poltergeist, DummyApp)
end
let(:test_page) do
- Napybara::DSL.build(session) do
- extend_element do
- def visit!
- visit '/test.html'
- end
+ Napybara::Element.new(session) do |page|
+ def page.visit!
+ get.visit '/test.html'
end
- find :form, 'form' do
- find :notice_updater, 'button.update'
- find :notice, '.notice'
+ page.finder :form, 'form' do |form|
+ form.finder :notice_updater, 'button.update'
+ form.finder :notice, '.notice'
end
end
end
Steps do
Given 'my page has an element A whose content changes a second after
another element B is clicked' do
test_page.visit!
- expect(test_page.form.notice).to have_content('Old content.')
- expect(test_page.form.notice).to have_no_content('New content.')
+ expect(test_page.form.notice.get).to have_content('Old content.')
+ expect(test_page.form.notice.get).to have_no_content('New content.')
end
When 'I click on element B' do
- test_page.form.notice_updater.click
+ test_page.form.notice_updater.get.click
end
Then 'checking if element A has the new content should be true' do
- expect(test_page.form.notice).to have_content('New content.')
- expect(test_page.form.notice).to have_no_content('Old content.')
+ expect(test_page.form.notice.get).to have_content('New content.')
+ expect(test_page.form.notice.get).to have_no_content('Old content.')
end
end
end
end
end