From 15e474a4fe8107684f78020da93c4a8e3ae465ff Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Tue, 17 Jul 2018 16:39:00 -0500 Subject: [PATCH 1/4] add tip --- style/ruby/README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/style/ruby/README.md b/style/ruby/README.md index 51f1b11..2072320 100644 --- a/style/ruby/README.md +++ b/style/ruby/README.md @@ -229,7 +229,7 @@ https://github.com/hanmoi-choi/reek-emacs # good - assert_predicate @user, :valid? # on error: expected @user to be valid? + assert_predicate @user, :valid? # on error: expected @user to not be valid? assert_includes response['message'], 'must be a valid email' # on error: expected response['message'] to include 'must be a valid email` @@ -240,6 +240,22 @@ https://github.com/hanmoi-choi/reek-emacs assert response['message'].include?('must be a valid email') # on error: expect false to be truthy ``` +- Use the negative variations of selector tests if you are testing that a selector is not present. + Using the positive form of these selector tests will always make Capybara wait + the default selector timeout time, and this includes using these with `assert_not`. + + ```ruby + + # good + + assert page.has_no_content?('Submit') # immediately executes if 'Submit' is not found + + # bad + + assert_not page.has_content?('Submit') # always waits the default Capybara timeout time + ``` + + ### System Tests ##### Organization From aac7e5c78a4832a90d6f89733dd0790af62759b6 Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Tue, 17 Jul 2018 16:40:03 -0500 Subject: [PATCH 2/4] fix typo --- style/ruby/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/style/ruby/README.md b/style/ruby/README.md index 2072320..6600d37 100644 --- a/style/ruby/README.md +++ b/style/ruby/README.md @@ -229,7 +229,7 @@ https://github.com/hanmoi-choi/reek-emacs # good - assert_predicate @user, :valid? # on error: expected @user to not be valid? + assert_predicate @user, :valid? # on error: expected @user to be valid? assert_includes response['message'], 'must be a valid email' # on error: expected response['message'] to include 'must be a valid email` @@ -256,6 +256,10 @@ https://github.com/hanmoi-choi/reek-emacs ``` +<<<<<<< HEAD +======= + +>>>>>>> eada21b... add tip ### System Tests ##### Organization From 985f337d612991fd2722c1a5da863abdb495aad1 Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Tue, 17 Jul 2018 16:40:26 -0500 Subject: [PATCH 3/4] remove typo --- style/ruby/README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/style/ruby/README.md b/style/ruby/README.md index 6600d37..50dfb75 100644 --- a/style/ruby/README.md +++ b/style/ruby/README.md @@ -255,11 +255,6 @@ https://github.com/hanmoi-choi/reek-emacs assert_not page.has_content?('Submit') # always waits the default Capybara timeout time ``` - -<<<<<<< HEAD -======= - ->>>>>>> eada21b... add tip ### System Tests ##### Organization From dfcf4d6804c45281fb901ab8a73fd09984bc0c12 Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Tue, 17 Jul 2018 16:47:46 -0500 Subject: [PATCH 4/4] Update README.md --- style/ruby/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/style/ruby/README.md b/style/ruby/README.md index 50dfb75..565c425 100644 --- a/style/ruby/README.md +++ b/style/ruby/README.md @@ -240,9 +240,9 @@ https://github.com/hanmoi-choi/reek-emacs assert response['message'].include?('must be a valid email') # on error: expect false to be truthy ``` -- Use the negative variations of selector tests if you are testing that a selector is not present. - Using the positive form of these selector tests will always make Capybara wait - the default selector timeout time, and this includes using these with `assert_not`. +- Use the negative variations of Capybara matchers if you are testing that an element or selector is not present. + Using the positive form of these matchers will always make Capybara wait + the default matcher timeout time, and this includes using these with `assert_not`. ```ruby