You can chain multiple Capybara matchers on the page or any element: expect(page) .to have_content('Example Course')

...data is guaranteed. There are however cases where you want to improve the user behavior (Rails error box) or reduce the number of exceptions e-mailed to your / collected by...

Your objects are now inspected with pretty colors: Note that if your inspection becomes wider than your terminal, IRB will automatically break it across multiple lines, like you probably...

blog.bigbinary.com

...joined tables or multiple queries? If you don't like the cleverness of this behavior, you can explicitely tell ActiveRecord how to preload associations with either JOINs or separate queries...

...includes usually works nicely, but Rails will apply some magic, as mentioned at the beginning of this card. This is subject to issues with polymorphic associations, too...

...form disables the submit button while working. // bad (how we used to do it) beforeEach(() => { this.form = setupMyForm() this.submitButton = findTheSubmitButton() }) it('disables the submit button while working', (done) => { expect(this.submitButton.disabled).toBe...

...our specs to simply return a Promise, so we could rewrite this as // slightly better it('disables the submit button while working', () => { expect(this.submitButton.disabled).toBe(false) let submitPromise = this.form.onSubmit()

makandra dev
ruby-doc.org

...used for case-equality. In general it tells if the object on the right "belongs to" or "is a member of" the object on the left: String === "hello" # true

...ms have passed!') }, function(reason) { console.error('Something went wrong: %o', reason) } ) This will become more important when we talk about async/await later. Exceptions are converted within then() handlers function fetchUsers...

} If f1() and f2() have an async API, our control flow must become async: function f1() { return Promise.resolve(2) } function f2(x) { return Promise.resolve(x * x) }

...JavaScript every day, even when our backend code uses another language. While we've become quite adept with JavaScript at a basic level, I think many of us lack a...

Every function may use this, even if the function does not belong to the object. The default value of this is the global object (window in browsers...

github.com

...that you can also make your matcher chainable, so a test can modifier its behavior. Using chaining you can write a matcher like this: expect(x).to be_a_multiple...

...may feel odd that the SQL statement says "UPDATE new_table". If your migration becomes too complex, you could put your logic into multiple reversible blocks (so they contain only...

end end A word of advice: Depending on your migration, you might be better off just defining 2 separate up and down methods instead of using change...

...as the video is free for end users." (MDN) H.265 / HEVC see H.264 (successor, better compression as H.264) VP8 royalty free VP9 royalty free (sucessor, better bit rate as VP8...

royalty free (planned successor of VP9 with better compression rates) Further reading: MDN: Web video codec guide Audio Codec Format Matrix A broader comparison of many audio codecs can...

makandra dev
unpoly.com

...within the current page, taking great care to emulate the browser's native scrolling behavior: Hash links will now honor the viewport's scroll-behavior: smooth style. Hash links can...

...now override their scroll behavior using an [up-scroll-behavior] attribute. Valid values are instant, smooth and auto (uses CSS behavior). Hash links will now always scroll to a fragment...

When testing JavaScript functionality in Selenium (E2E), you may need to access a class or function inside of a evaluate...

...Compliance Level; Asset file size could be reduced 2 New slider library has a better API Add capybara_lockstep 2 0 - 5 Reduce flaky integration tests

...selectively for your current need of change. For a more detailed example on this behavior compared to the --worktree option you can have a look on the example within the...

...git restore with --source for the usage --staged compared to --worktree To get a better idea, why this behavior might be useful I will add an example for both commands...

relishapp.com

Sometimes you have a test expectation but actually want a better error message in case of a failure. Here is how to do that. Background Consider this test: expect(User.last...

Why is this cool? One might argue why we would want to have better error messages for test expectations when our tests are supposed to be always passing. Well...

makandra dev
github.com

...However, users with limited bandwidth (i.e. on mobile) need to mine their data budget better. One popular strategy to improve the website performance is to not load images until they...

...via jQuery, as it does not support capturing events. JS-only: not working The "best" strategy would be to hide the src attribute of image tags from the browser with...

The Truemail gem (not to be confused with truemail.io) allows validating email addresses, e.g. when users enter them into a...

So you have a heading that is just barely wider than the container it should fit into, and it wraps...

makandra dev
gist.github.com

...byebug commands, it comes in handy with it's features for many use cases beyond that to make your life easier. For this cheatsheat I tried to structure the most...

...instance_methods(false). method -- The same as running .methods. Commands to change (or add) behavior at breakpoints display / undisplay [ ] - display or undisplays an expression at stopped breakpoint enable / disable [id...

ruby-doc.org

Ruby has the class Rational which allows you to store exact fractions. Any calculation on these variables will now use...

docs.ruby-lang.org

...argument. Also, the code after the yield in example is not executed! Probably, this behavior was designed to enable programmers writing their own iterators (like while or loop) as methods...

makandra dev
developer.mozilla.org

The standard way to abort async code is that your function takes a AbortSignal { signal } property. The caller can use...

github.com

...for the event to be processed before continuing - the event could prevent the default behavior. Luckily there is a concept called passive event listeners which is supported by all modern...

...see a performance gain when declaring scroll events as passive. To improve the scrolling behavior you should still try to keep the execution time of your handler to a minimum...