Sha256: fda890d1ff908b04ed11e9a73bd29f342b6f2ab420cf5fe836ab5b55756d40b2
Contents?: true
Size: 1.71 KB
Versions: 2
Compression:
Stored size: 1.71 KB
Contents
require 'spec_helper' require 'howitzer/capybara/dsl_ex' RSpec.describe Howitzer::Capybara::DslEx do let(:test_page_klass) do Class.new do include Howitzer::Capybara::DslEx extend Howitzer::Capybara::DslEx end end let(:test_page) { test_page_klass.new } describe '#find' do context 'when string argument with block' do subject { test_page.find('foo'){ 'bar' } } it do expect(test_page.page).to receive(:find).with('foo').and_yield.once subject end end context 'when first hash argument and second hash' do subject { test_page.find({xpath: '//bar'}, {with: 'foo'}) } it do expect(test_page.page).to receive(:find).with(:xpath, '//bar', {:with=> 'foo'}).once subject end end context 'when array argument' do subject { test_page.find([:xpath, '//bar']) } it do expect(test_page.page).to receive(:find).with(:xpath, '//bar').once subject end end end describe '.find' do context 'when string argument with block' do subject { test_page_klass.find('foo'){ 'bar' } } it do expect(test_page.page).to receive(:find).with('foo').and_yield.once subject end end context 'when first hash argument and second hash' do subject { test_page_klass.find({xpath: '//bar'}, {with: 'foo'}) } it do expect(test_page.page).to receive(:find).with(:xpath, '//bar', {:with=> 'foo'}).once subject end end context 'when array argument' do subject { test_page_klass.find([:xpath, '//bar']) } it do expect(test_page.page).to receive(:find).with(:xpath, '//bar').once subject end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
howitzer-1.1.1 | spec/unit/lib/capybara/dsl_ex_spec.rb |
howitzer-1.1.0 | spec/unit/lib/capybara/dsl_ex_spec.rb |