Sha256: 15bbdc3845dd2070ad9dbee161caca32e4324d52692a38eaea6fff2b1babc674
Contents?: true
Size: 1.39 KB
Versions: 5
Compression:
Stored size: 1.39 KB
Contents
require 'spec_helper' RSpec.shared_examples :dynamic_section_methods do let(:web_page_object) { web_page_class.new } describe '#name_section' do let(:capybara_element) { double } subject { web_page_object.send("#{section_name}_section") } before { expect(session).to receive(:find).with(*finder_args).once.and_return(capybara_element) } it { is_expected.to be_a(section_class) } end describe '#name_sections' do subject { web_page_object.send("#{section_name}_sections") } let(:capybara_element1) { double } let(:capybara_element2) { double } before do expect(session).to receive(:all).with(*finder_args).once.and_return([capybara_element1, capybara_element2]) end it 'should return collection of sections' do res = subject expect(res.size).to eq(2) expect(res.first).to be_a(section_class) expect(res.last).to be_a(section_class) end end describe '#has_name_section?' do subject { web_page_object.send("has_#{section_name}_section?") } before { expect(session).to receive(:has_selector?).with(*finder_args).once.and_return(true) } it { is_expected.to eq(true) } end describe '#has_no_name_element?' do subject { web_page_object.send("has_no_#{section_name}_section?") } before { expect(session).to receive(:has_no_selector?).with(*finder_args).once.and_return(true) } it { is_expected.to eq(true) } end end
Version data entries
5 entries across 5 versions & 1 rubygems