Questions tagged [RSpec] (39)

1
answer

How to write rspec test sources for testing or controller to race conditions?

Good day to all, please help. How to write a test for a RoR-based application in which I want to test the absence of race conditions in the action of the controller. I read an article Testing race conditions in your Rails app, written by Robert Pankowecki. It turned out the following: describe Cabinet::Balance::BalanceCont...
caleb_Kreiger asked April 7th 20 at 10:05
1
answer

In rspec method to force the module to return what you need using the new syntax?

Hi all. RSpec 3.8 5.2.1 Rails There is a module:module X included do after_create :test_method end def test_method ... end end and there is a model that uses this method:class ParentModel < ApplicationRecord include X end there is also a model that is a child ParentModelclass ChildModel < ApplicationRecord belon...
nicola70 asked March 20th 20 at 12:41
0
answer

How to add directory in spec_helper?

How do I add a migration in the spec_helper, what would they by default were available in the tests using only the require 'spec_helper' and not connecting each migration separately. Tell me some literature or an article on this subject, I would be very grateful.
Luisa.Crona92 asked March 16th 20 at 21:14
0
answer

How to test the migration using Rspec?

Are you new to Rails and Rspec. Before me there is such task, there is a migration that adds the values in the database. How to test it using Rspec. Need to test that all values are added. Interested in an example implementation, namely how to run migrations in the test, i.e. how to invoke the migrate inside the test. Perh...
Maxime14 asked March 16th 20 at 14:37
2
answers

How to run rspec tests in docker container from RubyMine?

Hi all. Starting a new project and decided to finally learn Docker. Dealt with docker-compose, made the images for the application and database. But then the question arose how to run the rspec tests. I can of course run via docker-compose run --rm -e "RAILS_ENV=test" app bin/rspec, but I would like RubyMine, because it's...
Olen.Ernser asked March 14th 20 at 16:39
1
answer

Advise the literature on BDD for dummies (rails)

The Rspec Book is a bit hard (strange, it seems there is nothing complicated and written in clear...). Particularly interested in the question of appropriateness of coverage of the views/controllers/models, all at 100%? In short, I want to read about generally accepted practices and common sense in this matter, in addition ...
bernadine.Wiegand53 asked October 10th 19 at 08:13
0
answer

To test a ruby TCPSocket server

There is a server based on GServer. There are clients that send messages to the server. Messages should be sent to the other clients connected to the server. How to use rspec to test simultaneous connections(when one client sends and other listen)? Sources: # Handle each connection def serve(io) io.puts("LOGIN\n") # Lis...
Moses92 asked October 7th 19 at 23:14
1
answer

Rails projects with quality, DRY specs?

I want to see how professionals write specs
Linnea_Langworth asked October 7th 19 at 12:04
1
answer

How to run rspec tests from vendor/engines/* together with tests of the main application?

Write modular application based on ending, which lie in the folder vendor/engines/*. Each module has its own rspec tests. As you can download them from the main application, so these tests were run together with the tests of the application itself?
Jimmie.Fah asked October 2nd 19 at 15:05
2
answers

Where can you find good information about Moki and stubs in rspec?

Actually studying testing of controllers, can't understand the difference between Mogami and stable and generally what they are used. If someone figured out prompt explanatory article or describe it in simple terms. Thank you.
Lucio5 asked September 26th 19 at 07:31