In this post, we will see how to resolve How to change DRY a spec to avoid deprecation warning “The implicit block expectation syntax is deprecated, you should pass a block…” Question: I have to following rspec fragment: I get ...
In this post, we will see how to resolve Every time I test, the number of test users is increasing…? Question: I’m a newbie so sorry if this is a basic question. I’m using M1 Mac. I am creating an ...
In this post, we will see how to resolve Is there a way I can force a record to not be destroyed when running a feature test in RSpec? (Rails 6) Question: For context, I have a controller method called ...
In this post, we will see how to resolve (Rails) Can’t use variable made by FactoryBot in rspec Question: i have two model, post and comment post has many comment this is my schema -> and my route is like ...
Question: I have an API that I’m currently using rspec to do the tests. In a specific test, I do a patch/put in a unity giving invalid values, but when I do the same test he responds with a status ...
Question: I can’t get rspec/capybara to click my radio button. There are many similar questions on SO, but I can’t find the right answer for me. My HTML/CSS is straight from the Bootstrap site: The test code (iteration #25 ;-( ...
Question: I want to stub set_user_tokens which is executed on the initialized (not saved) ActiveRecord object. This method assigns a token to the login object. So I want to stub setu_user_tokens method: to receive login ActiveRecord object with attributes of ...
Question: I want to check if my result set is of type ActiveRecord::Associations::CollectionProxy for example my models are as follows When i do organisation.dashboards i want to check if its ActiveRecord::Associations::CollectionProxy but something like the below does not work. Any ...
Question: I am working on a project where I have to test an external api which is making call to github. Let’s take the code below as example, the class below does not have intializer As you can see my ...
Question: I am using the google-maps gem. I am trying to mock/stub api requests unsuccessfully. I need to stub: If I try a most basic stub I get an error: I think it is erroring out because I am not ...