If the argument list is the same every time: expect(object).to receive(:foo).with('argument').and_return('response 1...
Here is how to use Chromedriver without libraries like selenium-webdriver. This can be useful for debugging. The following example...
When flagging a spec that will be implemented later as pending, include a failing spec body or RSpec 3 will...
To check which elements an ActiveRecord relation contains use the contain_exactly matcher. describe User do let!(:admin) { create(:user...
The issue: You are using stub_const to change a constant value for your test. stub_const "SomeClass::CONST", 'test...
Situation: You want to write a spec for a function inside an Angular service. This function at some point makes...
Sometimes when working with VCR you still want to use webmock. Since VCR hooks into webmock and fails when an...
RSpec allows you to mark a single Example/ExampleGroup so that only this will be run. This is very useful when...
When an Rspec example fails, I usually investigate by running that example again using rspec . However, this does not work...
You are not using javascript tests The file is served from a public folder (not via controller) Problem description...
Slides for Henning's talk on Sep 21st 2017. Understanding sync vs. async control flow Talking to synchronous (or "blocking...
RSpec allows defining methods inside describe/context blocks which will only exist inside them. However, classes (or any constants, for that...
before(:all) runs the block once before all of the examples. before(:each) runs the block once before each...
You should prefer native promises to jQuery's Deferreds. Native promises are much faster than their jQuery equivalent. Native promises...
You can not use the hash_including argument matcher with a nested hash: describe 'user' do let(:user) { {id: 1...
Rails default config uses the ActiveSupport::Cache::NullStore and disables controller caching for all environments except production: config.action_controller.perform_caching = false...
Nowadays it is fairly easy to intercept and modify mails globally before they are sent. All you have to do...
Webmocks hash_including is similar to RSpec::Mocks::ArgumentMatchers#hash_including. Be aware that hash_including (webmock v3.0.1) doesn't...
Middleman is a static page generator that brings many of the goodies that Rails developers are used to.
In modern default RSpec configurations, your tests are usually run in random order. This helps to detect "flickering" tests that...
Some pseudo-elements need to be addressed with vendor prefixes. E.g. ::selection is not supported by Firefox, you need to...
Line-height and vertical-align are simple CSS properties. So simple that most of us are convinced to fully understand...
This error message may occur when rspec gets loaded by rake, e.g. when you migrate the test database. NoMethodError: undefined...
You may know the double asterisk operator from Ruby snippets like Dir['spec/**/*_spec.rb'] where it expands to an arbitrary...