Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [rspec]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
6 votes
3 answers
3k views

Tracking flakey tests in Ruby on Rails / Rspec - is there a way to do this?

Currently working on a Ruby-on-Rails codebase, testing is done with Rspec. We use BuildKite to run tests. We are in a situation where sometimes tests will fail, and upon a retry or two, pass. AKA, we ...
2 votes
2 answers
142 views

Is it a good idea to violate the DRY rule for keeping the action in proper context?

Maybe that's simple, but it confuses me. I have such a code now: describe VarnishLogExaminer::Entry do let(:entry) do file_string = File.read('./spec/assets/varnish_example.xml') ...
1 vote
2 answers
1k views

Should I be writing feature or request specs?

I've been writing model specs for a while now and I'm gradually moving towards integration testing. Right now, I'm looking at the best way to test the output of my ActiveAdmin dashboard but I'm unsure ...
0 votes
1 answer
143 views

Name of a symbol in ruby

I'm very new to ruby. I have to code in ruby at work and a coworker gave me some tests he wrote in ruby. I have some difficulties to understand a line he wrote. We have a class like this: class Port ...
1 vote
3 answers
123 views

Replace repeated timestamp with variable in tests

I have couple hundred tests and I work with date/time a lot. In some tests, I aim for output format, elsewhere, I check date ranges. Therefore, my tests have lots of these: FactoryGirl.create(:foo, ...
3 votes
2 answers
1k views

Should you mock key-value stores/aggregators

I've always been taught that your tests should run in isolation, and other than a db for ActiveRecord etc., your tests should not rely on any external software/services. e.g. I always mock my other ...
0 votes
1 answer
145 views

How can I write these services using SOLID and keep them easy to test?

I am trying to write a couple of classes using SOLID principles and having some trouble. The problem is quite simple. I have an application that tracks leads. Leads are created when events are raised ...
4 votes
1 answer
3k views

Should I use expect or should when writing RSpec specs? [closed]

Please can someone explain to me how I should go about deciding whether to use expect or should syntax for my rspec examples. From my understanding we should no longer be using the 'should' syntax. ...