1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Fix Minitest 6 warnings

This commit is contained in:
Thomas Walpole 2019-10-20 20:24:48 -07:00
parent 53bcc175dc
commit 28b2d84480

View file

@ -17,125 +17,125 @@ class MinitestSpecTest < Minitest::Spec
end end
it 'supports text expectations' do it 'supports text expectations' do
page.must_have_text('Form', minimum: 1) _(page).must_have_text('Form', minimum: 1)
page.wont_have_text('Not a form') _(page).wont_have_text('Not a form')
form = find(:css, 'form', text: 'Title') form = find(:css, 'form', text: 'Title')
form.must_have_text('Customer Email') _(form).must_have_text('Customer Email')
form.wont_have_text('Some other email') _(form).wont_have_text('Some other email')
end end
it 'supports current_path expectations' do it 'supports current_path expectations' do
page.must_have_current_path('/form') _(page).must_have_current_path('/form')
page.wont_have_current_path('/form2') _(page).wont_have_current_path('/form2')
end end
it 'supports title expectations' do it 'supports title expectations' do
visit('/with_title') visit('/with_title')
page.must_have_title('Test Title') _(page).must_have_title('Test Title')
page.wont_have_title('Not the title') _(page).wont_have_title('Not the title')
end end
it 'supports xpath expectations' do it 'supports xpath expectations' do
page.must_have_xpath('.//input[@id="customer_email"]') _(page).must_have_xpath('.//input[@id="customer_email"]')
page.wont_have_xpath('.//select[@id="not_form_title"]') _(page).wont_have_xpath('.//select[@id="not_form_title"]')
page.wont_have_xpath('.//input[@id="customer_email"]') { |el| el[:id] == 'not_customer_email' } _(page).wont_have_xpath('.//input[@id="customer_email"]') { |el| el[:id] == 'not_customer_email' }
select = find(:select, 'form_title') select = find(:select, 'form_title')
select.must_have_xpath('.//option[@class="title"]') _(select).must_have_xpath('.//option[@class="title"]')
select.must_have_xpath('.//option', count: 1) { |option| option[:class] != 'title' && !option.disabled? } _(select).must_have_xpath('.//option', count: 1) { |option| option[:class] != 'title' && !option.disabled? }
select.wont_have_xpath('.//input[@id="customer_email"]') _(select).wont_have_xpath('.//input[@id="customer_email"]')
end end
it 'support css expectations' do it 'support css expectations' do
page.must_have_css('input#customer_email') _(page).must_have_css('input#customer_email')
page.wont_have_css('select#not_form_title') _(page).wont_have_css('select#not_form_title')
el = find(:select, 'form_title') el = find(:select, 'form_title')
el.must_have_css('option.title') _(el).must_have_css('option.title')
el.wont_have_css('input#customer_email') _(el).wont_have_css('input#customer_email')
end end
it 'supports link expectations' do it 'supports link expectations' do
visit('/with_html') visit('/with_html')
page.must_have_link('A link') _(page).must_have_link('A link')
page.wont_have_link('Not on page') _(page).wont_have_link('Not on page')
end end
it 'supports button expectations' do it 'supports button expectations' do
page.must_have_button('fresh_btn') _(page).must_have_button('fresh_btn')
page.wont_have_button('not_btn') _(page).wont_have_button('not_btn')
end end
it 'supports field expectations' do it 'supports field expectations' do
page.must_have_field('customer_email') _(page).must_have_field('customer_email')
page.wont_have_field('not_on_the_form') _(page).wont_have_field('not_on_the_form')
end end
it 'supports select expectations' do it 'supports select expectations' do
page.must_have_select('form_title') _(page).must_have_select('form_title')
page.wont_have_select('not_form_title') _(page).wont_have_select('not_form_title')
end end
it 'supports checked_field expectations' do it 'supports checked_field expectations' do
page.must_have_checked_field('form_pets_dog') _(page).must_have_checked_field('form_pets_dog')
page.wont_have_checked_field('form_pets_cat') _(page).wont_have_checked_field('form_pets_cat')
end end
it 'supports unchecked_field expectations' do it 'supports unchecked_field expectations' do
page.must_have_unchecked_field('form_pets_cat') _(page).must_have_unchecked_field('form_pets_cat')
page.wont_have_unchecked_field('form_pets_dog') _(page).wont_have_unchecked_field('form_pets_dog')
end end
it 'supports table expectations' do it 'supports table expectations' do
visit('/tables') visit('/tables')
page.must_have_table('agent_table') _(page).must_have_table('agent_table')
page.wont_have_table('not_on_form') _(page).wont_have_table('not_on_form')
end end
it 'supports all_of_selectors expectations' do it 'supports all_of_selectors expectations' do
page.must_have_all_of_selectors(:css, 'select#form_other_title', 'input#form_last_name') _(page).must_have_all_of_selectors(:css, 'select#form_other_title', 'input#form_last_name')
end end
it 'supports none_of_selectors expectations' do it 'supports none_of_selectors expectations' do
page.must_have_none_of_selectors(:css, 'input#not_on_page', 'input#also_not_on_page') _(page).must_have_none_of_selectors(:css, 'input#not_on_page', 'input#also_not_on_page')
end end
it 'supports any_of_selectors expectations' do it 'supports any_of_selectors expectations' do
page.must_have_any_of_selectors(:css, 'select#form_other_title', 'input#not_on_page') _(page).must_have_any_of_selectors(:css, 'select#form_other_title', 'input#not_on_page')
end end
it 'supports match_selector expectations' do it 'supports match_selector expectations' do
find(:field, 'customer_email').must_match_selector(:field, 'customer_email') _(find(:field, 'customer_email')).must_match_selector(:field, 'customer_email')
find(:select, 'form_title').wont_match_selector(:field, 'customer_email') _(find(:select, 'form_title')).wont_match_selector(:field, 'customer_email')
end end
it 'supports match_css expectations' do it 'supports match_css expectations' do
find(:select, 'form_title').must_match_css('select#form_title') _(find(:select, 'form_title')).must_match_css('select#form_title')
find(:select, 'form_title').wont_match_css('select#form_other_title') _(find(:select, 'form_title')).wont_match_css('select#form_other_title')
end end
it 'supports match_xpath expectations' do it 'supports match_xpath expectations' do
find(:select, 'form_title').must_match_xpath('.//select[@id="form_title"]') _(find(:select, 'form_title')).must_match_xpath('.//select[@id="form_title"]')
find(:select, 'form_title').wont_match_xpath('.//select[@id="not_on_page"]') _(find(:select, 'form_title')).wont_match_xpath('.//select[@id="not_on_page"]')
end end
it 'handles failures' do it 'handles failures' do
page.must_have_select('non_existing_form_title') _(page).must_have_select('non_existing_form_title')
end end
it 'supports style expectations' do it 'supports style expectations' do
skip "Rack test doesn't support style" if Capybara.current_driver == :rack_test skip "Rack test doesn't support style" if Capybara.current_driver == :rack_test
visit('/with_html') visit('/with_html')
find(:css, '#second').must_have_style('display' => 'inline') # deprecated _(find(:css, '#second')).must_have_style('display' => 'inline') # deprecated
find(:css, '#second').must_match_style('display' => 'inline') _(find(:css, '#second')).must_match_style('display' => 'inline')
end end
it 'supports ancestor expectations' do it 'supports ancestor expectations' do
option = find(:option, 'Finnish') option = find(:option, 'Finnish')
option.must_have_ancestor(:css, '#form_locale') _(option).must_have_ancestor(:css, '#form_locale')
end end
it 'supports sibling expectations' do it 'supports sibling expectations' do
option = find(:css, '#form_title').find(:option, 'Mrs') option = find(:css, '#form_title').find(:option, 'Mrs')
option.must_have_sibling(:option, 'Mr') _(option).must_have_sibling(:option, 'Mr')
end end
end end