spec/unit/lib/capybara_helpers_spec.rb in howitzer-2.1.1 vs spec/unit/lib/capybara_helpers_spec.rb in howitzer-2.2.0

- old
+ new

@@ -4,11 +4,10 @@ RSpec.describe Howitzer::CapybaraHelpers do include Howitzer::CapybaraHelpers let(:selenium_driver) { false } let(:selenium_grid_driver) { false } - let(:phantomjs_driver) { false } let(:sauce_driver) { false } let(:test_object) { described_class } describe '#cloud_driver?' do subject { cloud_driver? } @@ -24,11 +23,11 @@ context 'when browserstack driver' do let(:driver_setting) { :browserstack } it { is_expected.to be_truthy } end context 'when not cloud driver' do - let(:driver_setting) { :phantomjs } + let(:driver_setting) { :poltergeist } it { is_expected.to be_falsey } end context 'when driver specified as String' do let(:driver_setting) { 'testingbot' } it { is_expected.to be true } @@ -45,19 +44,53 @@ context 'when :selenium_grid' do let(:driver_setting) { :selenium_grid } it { is_expected.to be_falsey } end context 'when not :selenium' do - let(:driver_setting) { :phantomjs } + let(:driver_setting) { :poltergeist } it { is_expected.to be_falsey } end context 'when driver specified as String' do let(:driver_setting) { 'selenium' } it { is_expected.to be_truthy } end end + describe '#headless_chrome_driver?' do + subject { headless_chrome_driver? } + before { allow(Howitzer).to receive(:driver) { driver_setting } } + context 'when :headless_chrome' do + let(:driver_setting) { :headless_chrome } + it { is_expected.to be_truthy } + end + context 'when not :headless_chrome' do + let(:driver_setting) { :selenium } + it { is_expected.to be_falsey } + end + context 'when driver specified as String' do + let(:driver_setting) { 'headless_chrome' } + it { is_expected.to be_truthy } + end + end + + describe '#headless_firefox_driver?' do + subject { headless_firefox_driver? } + before { allow(Howitzer).to receive(:driver) { driver_setting } } + context 'when :headless_firefox_driver' do + let(:driver_setting) { :headless_firefox } + it { is_expected.to be_truthy } + end + context 'when not :headless_firefox' do + let(:driver_setting) { :selenium } + it { is_expected.to be_falsey } + end + context 'when driver specified as String' do + let(:driver_setting) { 'headless_firefox' } + it { is_expected.to be_truthy } + end + end + describe '#selenium_grid_driver?' do subject { selenium_grid_driver? } before { allow(Howitzer).to receive(:driver) { driver_setting } } context 'when :selenium_grid' do let(:driver_setting) { :selenium_grid } @@ -66,10 +99,10 @@ context 'when :selenium' do let(:driver_setting) { :selenium } it { is_expected.to be_falsey } end context 'when not :selenium' do - let(:driver_setting) { :phantomjs } + let(:driver_setting) { :poltergeist } it { is_expected.to be_falsey } end context 'when driver specified as String' do let(:driver_setting) { 'selenium_grid' } it { is_expected.to be_truthy }