In Cucumber, scenario outlines help avoiding tests that are basically the same, except for a few variables (such as different inputs). So far, nothing new. The problem
...your test should (or should not) do something, like filling in a field only for some tests? Scenario Outline: ... When I open the form And I fill in "Name" with...
...a remote API, check out the VCR gem as an alternative to Webmock or stubbing hell. The idea behind VCR is that is performs real HTTP requests and logs the...
...in a .yml file. When you run the test again, requests and responses are stubbed from the log and the test can run offline. It's a great way to...
...GitHub repository is a bit like our "dev" cards deck, but groomed from a single person (Josh Branchaud). It includes an extensive list of over 900 TILs on many topics...
...TILs that were new to me. I encourage you to take your time to skim over the original list as well! Assoc For Hashes Hash#assoc can be used to...
...to do it. Make an educated decision: Is the code change worth the effort? Stay straight on track, don't go astray. Note: Usually, you'd refactor after finishing your...
...story. At times, it might be necessary to refactor up front. But try to keep refactoring out of your current task. Knowing where to optimize Things should only be optimized...
I recently did a quick research on how to better write down multiline statements like this: # Dockerfile RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get update \ && apt-get dist-upgrade -y...
...apt-get install --no-install-recommends --no-install-suggests -y \ ca-certificates \ curl \ unzip It turns out, there is! Buildkit, the tool behind docker build added support for heredoc strings...
...version understands? Did you double-check your @font-face declarations with all the hacky syntax that is required? Compare them with other declarations you find on the web.
...same name? This usually leads to trouble, but there are workarounds. Do IE's security settings prevent the download of webfonts? (see below) IE Security Settings can prevent font download...
To update your Rubygems to the latest available version, type the following: gem update --system Note that you have a separate Rubygems installation for each Ruby version in your RVM...
...or rbenv setup. Updating one does not update the others. Ruby 1.8.7 If you are using Ruby 1.8.7 you cannot use the latest version of Rubygems. Type the following to...
Container queries enable you to apply styles to an element based on the size of the element's container. If, for example, a container has less space available in the...
...surrounding context, you can hide certain elements or use smaller fonts. Container queries are an alternative to media queries, which apply styles to elements based on viewport size or other...
...in "Comment" with: """ This is a long comment. With multiple lines. And paragraphs. """ The step definition is part of the spreewald gem
...messages should include the ID of the issue your code belongs to. Our preferred syntax prefixes the issue title with its ID in brackets, e.g. [FOO-123] Avatars for users...
...When I go to the dashboard And console Then I should see "Hans Peter" AfterStep @slow-motion Waits 2 seconds after each step Example: @slow-motion Given there is a...
When I go to the dashboard Then I should see "Hans Peter" AfterStep @single-step Waits for a keypress after each step Example: @single-step Given there is...
In Rubocop you might notice the cop Style/CaseEquality for e.g. this example: def foo(expected, actual) expected === actual end In case expected is a Regex, it suggests to change it...
...foo(expected, actual) expected.match?(actual) end In case expected is a Regex or a String, you need to keep ===. Otherwise the actual expression is always converted to a regular expression...
Fresh Chrome installations now show a "Choose your search engine" popup in Europe. This might make your Cucumber tests fail. Fortunately there is a flag to disable the popup. Add...
...the following option to your chromedriver setup code: options.add_argument('--disable-search-engine-choice-screen') I found this flag in Peter Beverloo's list. Background: This was experienced locally with...
...with modern CSS features In the past, you might have resorted to bulky JavaScript solutions or CSS hacks like transitioning between max-height: 0 and max-height: 9999px. All of...
...them were awkward and/or have several edge cases. With modern CSS, there is actually a way to do it properly: Just use a display: grid container which transitions its grid...
If you have ... an object that defines to_hash (may well be a simple Hash instance) and pass it to a method with optional arguments and keyword arguments
...it is not set as the first optional argument. Instead, Ruby calls to_hash on the object and tries to match the result to keyword arguments. If the hash contains...
Sometimes you want to write a test for a business rule that's based on multiple variables. In your goal to cover the rule thoroughly, you start writing tests for...
...each permutation of all variables. Quickly it blows up into something unsustainable. With n variables for the business rule, you get 2n permutations/test cases. This is manageable with 2 variables...
...need to use XPath, you can have Nokogiri help you out on creating it. Simply use Nokogiri's xpath_for: Nokogiri::CSS.xpath_for('#foo') # => ["//*[@id = 'foo']"] Nokogiri::CSS.xpath_for('#foo...
...bar:nth-of-type(2)') # => ["//*[@id = 'foo']//*[contains(concat(' ', @class, ' '), ' bar ') and position() = 2]"] Since XPath is more powerful you may still need to do some hardcore XPath hacking eventually...
This card shows you how to format a card's content using Markdown. We use the Commonmarker interpreter, so here are examples for its dialect. Formatting **Bold** Bold _Italics_
Add a new line for a paragraph. Headlines Underline headlines with an equals sign or dash -- or start a line with a hash symbol: Hello World ----------- Lorem ipsum...
gem install foobar --version="=2.3.0.alpha2" Also bundle update will never update a stable version to a pre-release version unless the user explicitly requests it in the Gemfile...
...gem 'foobar', '=2.3.0.alpha2' A note on Semantic Versioning Semantic Versioning has a naming convention for pre-releases that is incompatible with that from RubyGems. In Semantic Versioning, the version...
...take the content-box for the element's shape, i.e. without margin, padding and border. shape-outside: content-box Set the margin where you want it, e.g. 10px left and...
Set the shape-margin to the same size as the margin. Note that the shape-margin can never exceed the (rectangular) margin-box of an element! --margin: 10px;
Just found out about a great feature in Rails that seems to be around since Rails 2. Start a console with the --sandbox (or -s) parameter: rails console --sandbox
...database will be rolled back on exit. Warning Changes beyond the database (deleting files, sending emails, etc) cannot be rolled back...
...a web developer, you know Google Analytics (GA). Probably you've dropped the GA snippet into more than one website, maybe you've even used its Javascript API to implement...
...configurable without changing anything in the application's code base (and much more beyond, see below). Only prefer GTM if the customer requests it, or if he is updating his...
You can scale background images in CSS to the container size using background-size (Demo). Commonly, we use contain or cover because we want to preserve the image's aspect...
If you do not want to do that, simply provide scaling values for X and Y: background-size: 100% 100% (a simple 100% would mean 100% auto and respect...
If you want to see how long your database queries actually take, you need to disable MySQL's query cache. This can be done globally by logging into a database...
SET GLOBAL query_cache_type=OFF; and restart your rails server. You can also disable the cache on a per query basis by saying SELECT SQL_NO_CACHE...