In Rails 4.x we have transactional fixtures that wrap each test in a database transaction. This transaction rollbacks all...

In Ruby on Rails 5 belongs_to associations required by default so the following code: class User < ApplicationRecord end class Post < ApplicationRecord belongs_to :user # to make it work in...

Best results in other decks

Ruby has two different ways to match the start and the end of a text: ^ (Start of line) and $ (End...

rspec.info

...Also see here for further examples. Please note: Usually it is preferrable to test behaviour, not method calls. Since the behaviour of both validators is thoroughly tested in their own...

Search in all decks