This is an interesting article about parallel testing and CI https://visuality.pl/posts/parallel_tests_without_waiting
This is an interesting article about parallel testing and CI https://visuality.pl/posts/parallel_tests_without_waiting
โก 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 ๐ฏ๐ต
Hi #ruby community I'm looking for other recommendation here https://codeberg.org/codeDude/romodoro-socket/src/branch/main/lib/romodoro/socket/timer/countdown.rb
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?
Hello #ruby people, How can I test using #Rspec that accept method is receive(triggered). The class is here https://codeberg.org/codeDude/romodoro-socket/src/branch/main/lib/romodoro/socket/timer/command_server.rb#L24
I having issues trying to mock and stub the dependencies
shoulda-matchers๊ฐ ์ค์ ๋ก ๋น์ ์ ์ํด ํ๋ ์ผ
shoulda-matchers๋ Rails ํ ์คํธ ์ฝ๋๋ฅผ ๊ฐ๊ฒฐํ๊ณ ๊ฐ๋ ์ฑ ๋๊ฒ ๋ง๋ค์ด์ฃผ๋ฉฐ, ๋ชจ๋ธ์ ๊ณ์ฝ์ ๋ช ํํ ๋ฌธ์ํํฉ๋๋ค.
#rspec #rails_testing
https://ruby-news.kr/articles/what-shoulda-matchers-is-actually-doing-for-you
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 ๐ง
RSpec `have_attributes` ๋ด ๋ณต์กํ ๋ฌธ์์ด ๊ฒ์ฆ: `satisfy` ๋งค์ฒ ํ์ฉ
RSpec `have_attributes` ๋งค์ฒ ์ฌ์ฉ ์, ๋ฌธ์์ด ์์ฑ์ ๋ํ ๋ณตํฉ์ ์ธ ํฌํจ/๋ฏธํฌํจ ์กฐ๊ฑด ๊ฒ์ฆ์ ํ๊ณ์ ์ ์ ์ํฉ๋๋ค.
SecureRandom ใ stub ใใใจใใชใ Rails ใฎ CSRF ใๅฃใใใฎใ
https://qiita.com/okarina-chaan/items/747be079183dd0d6cc83?utm_campaign=popular_items&utm_medium=feed&utm_source=popular_items
๋์ฟ ๊ฐ์ค์ ์ฌ๋ ๋ฐฉ์ง ์ต์ ์ ์ ์งํค๋ Ruby: ์ง์ง ๋์ ์์คํ SUPREME ์ฌ๋ก
๋์ฟ ๊ฐ์ค๋ Ruby ๊ธฐ๋ฐ์ SUPREME ์์คํ ์ ํตํด ์ง์ง ๋ฐ์ ์ ๊ฐ์ค ๊ณต๊ธ์ ์๋ ์ ์ดํ๋ฉฐ ๋๊ท๋ชจ ํ์ฌ์ ํญ๋ฐ๋ก๋ถํฐ ์๋ฏผ๋ค์ ๋ณดํธํ๊ณ ์์ต๋๋ค.
#rspec
https://ruby-news.kr/articles/ruby-at-the-front-line-of-disaster-prevention
Nice article about structuring your tests #ruby #rspec https://thoughtbot.com/blog/the-arrange-act-assert-pattern
#mildlysatisfying #rspec4Life #rspec
10591 is the zip code for Tarrytown, NY, the real world setting of Washington Irving's "The Legend of Sleepy Hollow".
This. I've seen a lot of garbage tests this year. I like #RSpec's `xit` shorthand for walking more slowly and deliberately through test scenarios, regardless of whether an agent is involved or not.
https://www.andy-gallagher.com/blog/stop-vibe-coding-your-unit-tests/
@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]
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
@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 :(
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?