From c026f0f0bdf6c1c8fda7d3cd7f2fc630ea0f5e20 Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Wed, 1 May 2019 12:12:34 -0700 Subject: [PATCH] Add test for click_on --- lib/capybara/spec/session/click_on_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lib/capybara/spec/session/click_on_spec.rb diff --git a/lib/capybara/spec/session/click_on_spec.rb b/lib/capybara/spec/session/click_on_spec.rb new file mode 100644 index 000000000..86e8a8b54 --- /dev/null +++ b/lib/capybara/spec/session/click_on_spec.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +Capybara::SpecHelper.spec '#click_on' do + it 'should default to being an alias for #click_link_or_button' do + @session.visit('/form') + @session.click_on('awe123') + expect(extract_results(@session)['first_name']).to eq('John') + end + + it 'should allow specifying a selector type' do + @session.visit('/form') + cbox = @session.click_on(:checkbox, 'form_terms_of_use') + expect(cbox).to be_checked + end +end