What is the argument against using before, let and subject in RSpec tests? [closed]

Interesting question; something that I want to know more about as well…. So dug in a bit, and here is what I uncovered: Thoughtbot style guide dictum about let, etc. In an earlier version of the style guide, there’s more to that statement: Avoid its, let, let!, specify, subject, and other DSLs. Prefer explicitness and … Read more

RSpec testing redirect to URL with GET params

From the documentation, the expected redirect path can match a regex: expect(response).to redirect_to %r(\Ahttp://example.com) To verify the redirect location’s query string seems a little bit more convoluted. You have access to the response’s location, so you should be able to do this: response.location # => http://example.com?foo=1&bar=2&baz=3 You should be able to extract the querystring params … Read more

Is the ‘Travel’ time helper not available in feature specs?

In order to use these helpers you have to include them into your tests. You can do this by either including it into single test suite: describe MyClass do include ActiveSupport::Testing::TimeHelpers end or globally: RSpec.configure do |config| config.include ActiveSupport::Testing::TimeHelpers end

tech