#Rspec

codeDude :archlinux: :neovim:codeDude@floss.social
2026-02-24

This is an interesting article about parallel testing and CI visuality.pl/posts/parallel_te

#ruby #rails #rspec #minitest

Gimรฉnez Silva Germรกn Albertogsgermanok@ruby.social
2026-02-19

โšก From ~30 minutes to ~2 minutes: how a Rails team achieved ultra-fast CI โ€” without rewriting tests.

Parallel RSpec done right, smart workload balancing, PostgreSQL on tmpfs (RAM), and even reconsidering cloud vs physical hardware.

Inspired by a Kaigi on Rails 2025 talk ๐Ÿ‡ฏ๐Ÿ‡ต

๐Ÿ”— rubystacknews.com/2026/02/18/%

#Ruby #Rails #CI #RSpec #DevOps #Performance #KaigiOnRails

codeDude :archlinux: :neovim:codeDude@floss.social
2026-02-06

Hi #ruby community I'm looking for other recommendation here codeberg.org/codeDude/romodoro

I''m not sure how to test this with #Rspec

basically the intention is test if the duration is for example 2 seconds the countdown spend 2 seconds.

Could you gimme ideas please?

#rails #coding #programming #unitTest #softwareDevelopment

2026-02-02

@kerrick And #RSpec.

Whenever I have to use anything other than #Ruby, I am immediately reminded of how every single testing framework is miles, no, light-years behind RSpec.

codeDude :archlinux: :neovim:codeDude@floss.social
2026-01-29

Hello #ruby people, How can I test using #Rspec that accept method is receive(triggered). The class is here codeberg.org/codeDude/romodoro
I having issues trying to mock and stub the dependencies

Rspec code

# frozen_string_literal: true

RSpec.describe Timer::CommandServer do
  let(:socket_server) { instance_double UNIXServer }
  let(:socket) { instance_double UNIXSocket }
  let(:coutdown) { instance_double Timer::Countdown }

  context "when the CommandServer start" do
    it "should accept the connection to the socket" do
      expect(socket_server).to receive(:accept).and_return socket

      allow(socket).to receive :puts
      allow(socket).to receive :close

      command_server = Timer::CommandServer.new socket_server, coutdown
      command_server.start
    end
  end
end
2026-01-23

shoulda-matchers๊ฐ€ ์‹ค์ œ๋กœ ๋‹น์‹ ์„ ์œ„ํ•ด ํ•˜๋Š” ์ผ

shoulda-matchers๋Š” Rails ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋ฅผ ๊ฐ„๊ฒฐํ•˜๊ณ  ๊ฐ€๋…์„ฑ ๋†’๊ฒŒ ๋งŒ๋“ค์–ด์ฃผ๋ฉฐ, ๋ชจ๋ธ์˜ ๊ณ„์•ฝ์„ ๋ช…ํ™•ํžˆ ๋ฌธ์„œํ™”ํ•ฉ๋‹ˆ๋‹ค.

#rspec #rails_testing
ruby-news.kr/articles/what-sho

three word chant3wordchant@social.coop
2026-01-09

As expected, the ~65% #RSpec test coverage meant that there have been several issues which came up during manual testing, including some very pleasantly head-scratching ones ๐Ÿง 

2026-01-03

RSpec `have_attributes` ๋‚ด ๋ณต์žกํ•œ ๋ฌธ์ž์—ด ๊ฒ€์ฆ: `satisfy` ๋งค์ฒ˜ ํ™œ์šฉ

RSpec `have_attributes` ๋งค์ฒ˜ ์‚ฌ์šฉ ์‹œ, ๋ฌธ์ž์—ด ์†์„ฑ์— ๋Œ€ํ•œ ๋ณตํ•ฉ์ ์ธ ํฌํ•จ/๋ฏธํฌํ•จ ์กฐ๊ฑด ๊ฒ€์ฆ์˜ ํ•œ๊ณ„์ ์„ ์ œ์‹œํ•ฉ๋‹ˆ๋‹ค.

#rspec
ruby-news.kr/articles/rspec-sa

:rss: Qiita - ไบบๆฐ—ใฎ่จ˜ไบ‹qiita@rss-mstdn.studiofreesia.com
2025-12-27

SecureRandom ใ‚’ stub ใ™ใ‚‹ใจใ€ใชใœ Rails ใฎ CSRF ใŒๅฃŠใ‚Œใ‚‹ใฎใ‹
qiita.com/okarina-chaan/items/

#qiita #Rails #RSpec #stub

2025-12-26

๋„์ฟ„ ๊ฐ€์Šค์˜ ์žฌ๋‚œ ๋ฐฉ์ง€ ์ตœ์ „์„ ์„ ์ง€ํ‚ค๋Š” Ruby: ์ง€์ง„ ๋Œ€์‘ ์‹œ์Šคํ…œ SUPREME ์‚ฌ๋ก€

๋„์ฟ„ ๊ฐ€์Šค๋Š” Ruby ๊ธฐ๋ฐ˜์˜ SUPREME ์‹œ์Šคํ…œ์„ ํ†ตํ•ด ์ง€์ง„ ๋ฐœ์ƒ ์‹œ ๊ฐ€์Šค ๊ณต๊ธ‰์„ ์ž๋™ ์ œ์–ดํ•˜๋ฉฐ ๋Œ€๊ทœ๋ชจ ํ™”์žฌ์™€ ํญ๋ฐœ๋กœ๋ถ€ํ„ฐ ์‹œ๋ฏผ๋“ค์„ ๋ณดํ˜ธํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

#rspec
ruby-news.kr/articles/ruby-at-

Madmanโ€™s Nestmadmansnest@mastodon.world
2025-12-26

hspec uses the same syntax Rspec used many years ago.

Makes me feel nostalgic.

Had to write a spec for some Ruby code recently, turns out instead of function(args).should_equal result one now has to write expect(function(args).to == result.

Oh why?

#haskell #ruby #hspec #rspec

Adam Niedzielskiadamsunday@ruby.social
2025-12-24
Aaron Sumnerruralocity
2025-12-22

๐Ÿฅณ Happy 30th birthday to , still my favorite programming language! Here's a coupon for my book for just $9, with practice advice. Free updates for Rails 8.1 and Ruby 4 coming early next year! Boosts appreciated! ๐Ÿฅณ

leanpub.com/everydayrailsrspec

|7eter l-|. l3oling ๐Ÿงฐgaltzo@ruby.social
2025-11-29

#mildlysatisfying #rspec4Life #rspec
10591 is the zip code for Tarrytown, NY, the real world setting of Washington Irving's "The Legend of Sleepy Hollow".

Screenshot of RSpec test result reading:
Finished in 22.33 seconds
777 examples, 0 failures
Randomized with seed 10591
Aaron Sumnerruralocity
2025-11-06

This. I've seen a lot of garbage tests this year. I like 's `xit` shorthand for walking more slowly and deliberately through test scenarios, regardless of whether an agent is involved or not.

andy-gallagher.com/blog/stop-v

2025-10-30

TIL in #Ruby #RSpec,

this:

expect(File.exist?(old_file)).to be true

can be shortened to this:

expect(File).to exist(old_file)

expect(File).to exist old_file

Neat!

2025-10-18

@postmodern and also, why doesn't #Ruby itself have an opposite direction of .include? method?

[1, 2, 3].include? 1

Like #Railsโ€™ .in?

1.in? [1, 2, 3]

Then the #RSpec would be:

expect(1).to be_in [1, 2, 3]

Esparta :ruby:esparta@ruby.social
2025-10-16

continuing about collection-based #rspec matchers...

When using `match` and `include` you can let the `it` spec to speak for itself:

```ruby
context 'when one of the values is off' do
it do
expect(subject).to match(
error: 'P',
context: be_a(String).and( eq('S'))
)
end
end
```

I tend to not declare what the `it` is, because it's gratifying see its errors :), usually that's the context blocks are for.

* puns intended
# ruby

An screenshot of my terminal, after running a failed-on-purpose specs:

collection
  when one of the values is off
    is expected to match {error: "P", context: (be a kind of String and eq "S")} (FAILED - 1)

Failures:

  1) collection when one of the values is off is expected to match {error: "P", context: (be a kind of String and eq "S")}
     Failure/Error:
       expect(subject).to match(
         error: 'P',
         context: be_a(String).and( eq('S'))
       )

       expected {:context => " S", :error => "P"} to match {error: "P", context: (be a kind of String and eq "S")}
       Diff:
       @@ -1 +1 @@
       -:context => (be a kind of String and eq "S"),
       +:context => " S",
Esparta :ruby:esparta@ruby.social
2025-10-16

@benjamineskola I'd argue that relying on concrete type is something the spec shouldn't care, at least not in #ruby

For example, perhaps it started with a hash, and that was OK, but later on the team want to change the implementation to use something else, like a Struct class.

Error = Struct.new('ErrorStruct', :error, :context)

error = Error.new('Pusher error', 'oops!')

then `be_hash_including` might fail because it's not a hash, is an Struct. Image having 433 spec files :(

#rspec

Esparta :ruby:esparta@ruby.social
2025-10-16

Lately I've found some resistance to use collection-based #rspec matchers

Checking element by element is technically not wrong:

expect(failure[:error]).to eq('Pusher error')
expect(failure[:context]).to eq('notify_notification_started')

but using `match` & `include` has their advantages:

expect(failure).to match(
error: 'Pusher error'
context: 'notify_notification_started'
)

I can elaborate further if someone ask for it.

Perhaps a blog post about it is needed?

#ruby

A comment in the peer-review tool, where I post my suggestion:

> if this a hash, please use a collection-based matcher:

Suggested change
```diff
-        expect(result.failure[:error]).to eq('Pusher error')
-        expect(result.failure[:context]).to eq('notify_notification_started')
+        expect(result.failure).to match(
+          error: 'Pusher error'
+          context: 'notify_notification_started'
+        )
```

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst