Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Teaching RSpec to play nice with Rails
Search
Penelope Phippen
April 25, 2017
Technology
2
130
Teaching RSpec to play nice with Rails
Presented at Railsconf 2017. Video here:
https://www.youtube.com/watch?v=jyPfrK1y1nc
Penelope Phippen
April 25, 2017
Tweet
Share
More Decks by Penelope Phippen
See All by Penelope Phippen
Introducing Rubyfmt
penelope_zone
0
550
How RSpec Works
penelope_zone
0
6.5k
Quick and easy browser testing using RSpec and Rails 5.1
penelope_zone
1
81
Little machines that eat strings
penelope_zone
1
94
What is processor (brighton ruby edition)
penelope_zone
0
100
What is processor?
penelope_zone
1
350
extremely defensive coding - rubyconf edition
penelope_zone
0
260
Agile, etc.
penelope_zone
2
220
Extremely Defensive Coding
penelope_zone
0
94
Other Decks in Technology
See All in Technology
インフラからSREへ
mirakui
20
7.6k
Kaigi Effect 2025 #rubykaigi2025_after
sue445
0
200
GPU 클라우드 환경에서의 회복탄력적 AI 운영 : 훈련 및 추론을 위한 견고한 아키텍처와 전략
inureyes
PRO
0
110
WindowsでGenesisに挑戦した話
natsutan
0
120
雑に疎通確認だけしたい...せや!CloudShell使ったろ!
alchemy1115
0
240
TanStack Start 技術選定の裏側 / Findy-Lunch-LT-TanStack-Start
iktakahiro
1
170
激動の一年を通じて見えてきた「技術でリードする」ということ
ktr_0731
8
8.3k
地に足の付いた現実的な技術選定から魔力のある体験を得る『AIレシート読み取り機能』のケーススタディ / From Grounded Tech Choices to Magical UX: A Case Study of AI Receipt Scanning
moznion
5
1.9k
最近のRedmineの開発動向と次期バージョン6.1.0
vividtone
0
110
インラインRBSコメントに鯛pe checkersもニッコリ
sansantech
PRO
1
170
Tailwind CSS の小話「コンテナークエリーって便利」
yamaday
0
150
AOAI で AI アプリを開発する時にまず考えたいこと
mappie_kochi
1
770
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.8k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
105
19k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
Making Projects Easy
brettharned
116
6.2k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Rebuilding a faster, lazier Slack
samanthasiow
81
9k
Facilitating Awesome Meetings
lara
54
6.4k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Code Review Best Practice
trishagee
68
18k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.4k
Producing Creativity
orderedlist
PRO
344
40k
Transcript
Teaching RSpec to play nice with Rails @samphippen
Friends, it’s good to be back
Last year I had a life threatening illness
None
A precious bag of ceftriaxone, saving my life
None
Thanks @searls
Thanks @searls #samphippenisjustin searlsconfirmed
5.1
Yes*
ActionChatbox::TestCase
ActionDispatch ::BeliefSystemTestCase
Have some faith in us
5.1 has not been released yet
No changes required by you
Released soon in 3.6.0
No system test integration
but I would welcome a PR
RSpec + Rails
RSpec
RSpec isn’t a monolith
gem “rspec”, “~> 3.5”
Does nothing on it’s own
None
None
None
None
Internal shared code
rspec-rails
None
None
RSpec Rails
RSpec Rails our code Your rails version
gem “rspec”, “~> 3.5” gem “rspec-rails”, “~> 3.5”
gem “rspec-rails”, “~> 3.5”
Rails
Rails is a big complicated library
RSpec is extremely permissive about rails versions
>= 3.0
None
None
None
Don’t ask
5
RSpec’s rails 5 compatability was not a smooth ride
Lesson 1: 5.0 means they break things
None
None
None
None
None
Let’s just make sure this works with RSpec
None
View specs don’t work
Specifically path helpers
None
None
Switch back to working version of rails
None
Work out what changed
controller .singleton_class .ancestors
None
None
So we lost 3 random anonymous modules
WTF even are they?
actionpack-5.0.0.beta2/ lib/action_dispatch/ routing/route_set.rb:283
At this point we call in an emergency rails maintainer
None
None
None
This is a huge win for collaboration
Lesson 2: Some bugs are in Rails
None
What the hell is a signed cookie?
None
None
None
None
None
So now the fun begins
git clone rails/rails
Point the app at that rails clone
git bisect bad
git checkout v4.2.0.beta4
git bisect good
None
None
None
and then I left it for a while
and went to Rubyconf
“You have a breaking commit sha? Show me”
None
None
None
“can be replicated purely with Rails using public API”
There exists a twisty turny maze of dependencies
Before filling an issue on a gem, check it’s not
in a dep
Lesson 3: Sometimes you can’t call in @sgrif
None
None
None
None
“I made a short screencast”
None
None
Do the bisect shimmy and shake
None
None
None
None
Explaining a lot of context in a PR message is
super useful
None
Gets merged!
None
It is fine to poke a maintainer to close an
issue once they’ve fixed it
Summary
A lot of bugs that appear in RSpec can be
because of rails
Literally every fix we saw today was in a rails
gem
A Rails reproduction script is a great place to start
None
I will almost always ask you for a reproduction sample
app
Just calling @sgrif is a great way to get rails
bugs fixed
None
Working on open source is really hard
None
This work represented 40+ hours of donated maintainer time
Hug a maintainer
Find some time to work on open source
Pay a maintainer?
None
None
Thanks @samphippen
[email protected]
Let’s have some questions