Why Write Rails View Tests
01-Apr-2021 1439
There are many ways to test a Ruby on Rails application, but there is one way that is not so often discussed. That is the way of testing Rails views. Yes - there are controller, model, and other types of tests, but we rarely see the view layer tests. Let’s give them more attention and see what they are all about.You might ask - well, why don’t you write integration tests and test view layer with them? I could, but running integration tests can be slow, and writing a simple view ‘unit’ test can be more straightforward. Plus, RSpec has great support for writing a view spec. What is even more interesting, I created an example project to test these out. Let’s see what I found out.
Why Write Rails View Tests #ruby #rubydeveloper #rubyonrails #Write #Rails #Tests #tests https://rubyonrails.ba/link/why-write-rails-view-tests