Testing

Summarized using AI

RSpec and Rails 5

Justin Searls and Sam Phippen • May 04, 2016 • Kansas City, MO

The video titled 'RSpec and Rails 5', presented by Justin Searls at RailsConf 2016, focuses on the evolution of RSpec and its relationship with Rails 5. Originally intended to be presented by Sam Phippen, the talk was adapted by Searls at short notice due to Phippen's hospitalization. The discussion delves into how RSpec fits within the Rails ecosystem, particularly addressing the changes and challenges developers face as new versions of Rails are released.

Key Points Discussed:
- Imposter Syndrome: Searls humorously addresses his feelings of inadequacy in stepping in for Phippen, highlighting the community dynamics and camaraderie among developers.
- Current RSpec Version and Future Release: He announces RSpec 5, describing notable new features such as 'Turbo Spec', which significantly improves the performance of test suites by caching setup code, and 'Spec Specs', allowing tests of tests to ensure they meet specific quality standards.
- RSpec's Evolution with Rails: Searls emphasizes the importance of maintaining support for older versions of Rails while introducing new features, detailing the labor involved for maintainers when major Rails upgrades occur.
- Deprecation of Functional Tests: He addresses the deprecation of controller specs in Rails 5, explaining the rationale behind this change and referencing a discussion initiated by DHH regarding valuable testing practices.

Searls encourages developers to appreciate the ongoing efforts of those maintaining RSpec and reminds the audience that changes often come with significant backend work that ensures a smooth upgrade path for users. Overall, the talk illustrates the evolving nature of testing frameworks in conjunction with versions of Rails, reinforcing the idea that understanding these tools is critical for effective software development.

RSpec and Rails 5
Justin Searls and Sam Phippen • May 04, 2016 • Kansas City, MO

Only a few days before RailsConf, I was asked by to fill in for this talk because of illnesss. The only catch: I would have to speak on the original topic, covering the same content, and without much in the way of ready-to-use prepared content. I stared at my white board for a few hours and agreed to do it.

The title of talk, as a result, is necessarily “RSpec and Rails 5”, but don’t let its name lead you to assume the scope of the talk is so narrow. By using the upcoming, perfunctory changes to both libraries as a jumping off point, the discussion quickly broadens to how developers relate to their tools over time, essentially asking “why should RSpec continue existing in 2016?”

More here: https://testdouble.com/insights/make-ruby-great-again

RailsConf 2016

00:00:00.709 All right, so when you walked in, you saw this. That's me, Justin Searls.
00:00:06.990 You can see how it's written by hand on an index card. There's a story behind that. This is not my talk, which is part of why I'm so nervous. But really, please don't leave. You're in the right place, at least, so just stay where you are, and I'm gonna do my best despite this.
00:00:21.449 This is actually not acceptable. I mean, I trolled so hard. Okay, so this is not the bait-and-switch. Most of my speaking experience relates to talks I've given at Rails before.
00:00:30.390 I intentionally wrote abstracts to get into the conference and then talked about what I wanted to talk about. So this is not a bait-and-switch like those two; it wasn't intentional that it is.
00:00:51.750 Now, this was supposed to be Sam Phippen's talk. Everyone, follow Sam; he's great! Sadly, Sam is in the hospital, so he wasn't able to give this talk, and that's why I'm here instead.
00:01:01.289 But it's a British hospital, so he's just in hospital. So send your good wishes to Sam. Why me? Why am I here? Well, Sam likes to give conference presentations wearing my company's branded t-shirt, Test Double.
00:01:14.580 So people are often mistaking him for one of our employees, to the extent that he now has intro slides saying, 'I do not work for Test Double,' but I love them, and also Searls, which I heartily appreciate. We love you too, Sam. That's why we're here. You're a great member of the community.
00:01:36.450 So this is how it's gonna be. It's fitting great. The only problem is, I finally understand imposter syndrome. I've got a little bit of imposter syndrome because I am a literal imposter today in three main categories.
00:01:53.070 One, I am not British. As we all know, as Americans, everything out of British people's mouths sounds a lot more intelligent. I have that shortcoming, and therefore today I resolved to use fewer contractions to speak with authority, and to drop the rata car.
00:02:11.760 So let's practice this together. 'Many tests are not better than RSpec.' All right, I feel better already. I lack Sam's glorious mane. I don't have a big bushy beard. Sam, of course, derives his RSpec powers from his beard.
00:02:28.159 This is obvious because why else would he have it? So I have not shaved since I agreed to do this at 7:00 a.m. Friday morning. Some struggles.
00:02:40.430 So I now know a few things based on the RSpec beard powers: One, beards are cheap; two, RSpec is fabulous; and three, what beard oil is! So if anyone— I forgot my razor, true story— if anyone has some beard oil on them, tuck a brother up with that.
00:03:00.430 Today I am NOT on the RSpec tour. Here is a little organizational chart of where I fit into RSpec on that scale. And that's me, not being in it. But you know what?
00:03:18.290 Apparently, it's just not a real sponsor without a talk from an RSpec committer about RSpec. So far, to date, the only RSpec thing I've committed to is this talk. So I decided to become an RSpec-ulator. Right? Sounds like a good idea. So let's get started.
00:03:39.049 I'm gonna make my first RSpec commit right here. I am so committed right now to RSpec. All right? So there's gonna push it up access tonight. I tried everything earlier, another job, so let's try one more time. Via always works. You know what you get?
00:04:14.900 This error message also when you get hubs down. So it's probably just the GitHub calendar. So as this talk's resident RSpec committer, I have some startling announcements to make.
00:04:32.870 I'm here, ready to announce the future of RSpec for you today. The current version of RSpec is 3.4.0. I'm here to announce the next major release of RSpec, RSpec 5.
00:04:56.080 RSpec 5 is going to be revolutionary because we have some really awesome headline features that are very convenient to me and my purposes.
00:05:08.150 The first: Turbo Spec! Let me tell you about Turbo Spec.
00:05:14.900 Yep, Turbo Spec dumps the object space into the cache in memory after running every single one of your before hooks. It does this so that it can cache each nested example group's setup code so that you don't have to run it across all your tests.
00:05:31.940 If you run the RSpec CLI with the tack-tack turbo button, it speeds up your tests. Turbo Spec is gonna make all of our slower spec suites way faster. Warning: it doesn't work if your application has side effects.
00:05:48.010 But for the rest of us, it's gonna be just awesome. I have another feature for RSpec 5 that I think is going to really make true believers of RSpec happy: Spec Specs.
00:06:07.440 You just create a spec of type 'spec', and then you can say things like, 'Hey, this model order, I expect it to have five specs, I expect the order to finish within about two hours, to have 95% code coverage, to limit the nesting and indentation to just three contexts, to usually pass, and to be good code.' I don't know why they didn't have this in RSpec 3. It's in RSpec 5.
00:06:41.100 Remember, it's important to spec your spec specs, people. Let's not get lazy!
00:06:49.800 And I said, 'Justin, just give it a rest.' Obama saying things audio doesn't work anymore because of their shenanigans. Let's try one more time.
00:07:03.290 I'm still— anyway, regardless I'm not sure if I'm cured or if I'm still impostor-ing. You know, I am NOT Sam. If you don't know me, this is what I look like on Twitter when I'm getting retweeted for saying terrible things.
00:07:20.440 That's me, Searls. I'd love if you became my Twitter friend and got me some feedback about how things are going. I know it's not great so far.
00:07:32.970 This is the Justin Searls marriage simulator: basically, it's just you sitting across the table from me looking at my phone and making slanted faces so we can all empathize with Becky and Joey a little better.
00:07:43.490 And this is me on brand. I helped run a software agency called Test Double. Our mission is audacious: we're just trying to make software less awful.
00:08:04.050 I'd love if you got us any feedback: [email protected].
00:08:20.360 So again, talk title: Back to Basics, RSpec and Rails 5. What's there to know? By the way, did you know Sam rejected my RailsConf talk?
00:08:31.480 I just thought I should mention that because I am supposedly honor-bound to cover all this Rails 5 stuff, which I took with just nothing but grace.
00:08:40.950 So, Rails 5 stuff. My first question to Sam via text message on Friday morning was, 'Will RSpec just work with Rails 5?' No.
00:08:57.430 He was saying, as an implementer, he's thinking about all the work they need to do because obviously, if you've ever maintained a gem, newsflash: major Rails releases break gems in surprising, myriad ways.
00:09:10.950 I went and searched for just open GitHub issues that are demanding Rails 5 support. Just search for it, and you get a whole lot of salty randoms saying, 'Hey, Rails 5 is not supported. No description. Give me Rails 5. You owe me. Come on, gems, work! Work! Give me Rails!'
00:09:26.180 Rails 5's not even out yet, people! So if you know a maintainer, go give that maintainer a hug.
00:09:41.260 Because seriously, Rails major release upgrades are big work. RSpec considers this to be feature work. They don't want to break; they want to give you the ability to upgrade gracefully.
00:09:53.900 That's why they respect support so much. As much as I don't, they're at 3.4.0; now it's going to be 3.5.0, which means that they have to keep it running for older versions of Rails, but also new versions of Rails.
00:10:06.780 So I hope that you can take a moment to thank the RSpec team for their thankless work because everything that they're doing here is behind the scenes.
00:10:20.390 But there is one change that we all have to know about, which is: Is it true that like functional tests and controller specs are really deprecated? Well, yes, it actually is true.
00:10:32.380 They're going away with Rails 5, if they're deprecated. At least action controller is deprecated, to which I say, finally!
00:10:50.080 If you don't write controller specs, by the way, feel free to just play with your phone for this portion of the talk. If you do, it all started when DHH opened this issue, saying, 'You know, the mechanism for verifying that you assigned a particular instance variable in a controller, making sure that a particular template was going to get rendered, those are testing implementation; those aren't really valuable. Let's deprecate functional tests.'
Explore all talks recorded at RailsConf 2016
+106