Penelope Phippen is a lead maintainer of the RSpec testing framework. She’s been writing Ruby for just about a decade, and still remembers 1.8.6. She’s sad that she can’t hug every cat.View the profile
About the talk
RailsConf 2019 - Cleaning house with RSpec Rails 4 by Sam Phippen
RSpec Rails is RSpec's wrapper around Rails' testing infrastructure. The current stable version, 3.8, supports Rails = 3.0, and Ruby = 1.8.7, that's a lot of versions to support! With RSpec Rails 4, we're fundamentally changing how RSpec is versioned.
In this talk you'll see a pragmatic comparison of ways to version open source. You'll see how we ended up with RSpec's new strategy. You'll learn what's coming next : Rails 6.0 parallel testing and ActionCable tests. This talk focuses heavily on open source process, and is less technical, so should be accessible to folks of all levels.
I wasn't expecting to be introduced is the birthday boy prudential's that's the one I was expecting Chris to leave with. Thank you. We'll get we'll get to it. I promise this is cleaning house with all step rails for let's get started myself on the internet. This profile picture was taken on a very fancy camera before I remove my beard. My birthday I'm 28, and the day has been a little bit of reflective day for me. I spoke to my parents and my mom was like
you're going to be a computer programmer and I was like, how did you know that? Who's me age 1 on the IBM PC portable. Yeah, I just looked out so many different ways that you can give it to look at a conference in this sort of like speaking and slide structure is one that's being fairly well done at this point. So unreasonable with you. I went to Twitter at your office with a pole I said, would you listen to an unstructured run while I just talked about all spec 59% said yes, 41% said no
human would do. I computed the P value to determine whether or not that result if I actually significant is not so Chris. Don't worry. We have instructions to look exactly as I submitted to the cfp. I'm not just going to yell at you for 40 minutes. Fruit, I want to talk about the word compatibility going to mesh together. Well, maybe when you upgrade something, is it going to continue to what is your past week functional is your application functional I
would be willing to bet the most of you Ralph has more code in it then you can person in your application. Play It's the End of the conference and I'm sure everyone's feeling a little bit low energy. Sorry can everyone put their hands up please we're going to do poll time. Okay. I want you to put your hands down if you're up north. If you have no test Suite in your application whatsoever. Put your hands down if you have at a sweet, but you're not super happy with it. It's flaky. It breaks all the
time while to get helping please with the front just put their hands down. So we should all feel really great about You have a really great time sweet keep your hands off only if you have a really great test, we if it's green you would push to production with no fear whatsoever. A bunch of you. I'm very impressed. Good Joe Freeman has went back up. That's why she's surprised when you present the rear between castor oil is a community of testing application. But what if I did this to
your app? What if I came in deleted Road Enfield Outlook ran bundle update committed pushed and immediately deployed to production. Face screaming in fear Emoji, you'll see that your application has with no bounds what constraints whatsoever. You better be sure that your gemfile is Penning everything exactly as you want and if you're not stuff is going to blow up. What combat compatibility we say which versions We want and then we do a bundle install it looks them. But if we delete that book file,
when was free to play Nothing it in at once. If you have a pain like this, we have something that's really important to your application and you don't specify a bush in running a bundle in store when they look finally just going to pull the lease, especially if it's something that could well break it if it's a new major or if those being significant change in how it was suddenly replication might start walking. And the converse is true as well. Right if we have pens the two specific. Can we try to upgrade something else? We might fail to bundle and suddenly our application is. Be several
Russians behind the currently discussions will be applications that were watching on a specific pins in a dependency. You consider cold constraints and Technical applications and it's really important when you're building a gem file that you want to make sure that you're being diligent and careful about what kind of pins will specifying now in the Ruby Community. We're very lucky that we have basically completely standardized on semantic versioning which gives us a mechanism talking about how we brush my library is
in a mine of ocean and a patch level and it tells us how to write them down. Right? We write three digits activity on major. Why would be would be leveled. This is what it means when you see installing a few Jerry 1.7.3 when they took sessions one would be a major and three would be all pass level. Semantic versioning also gives us a specification for how to like change those number that tells us when we're supposed to increment each of the positions. Right? And so if you fix the bugs to my toothbrush and
Coldspring commencing of the pets level if you've been implemented or releasing you feature change backwards compatible behavior and mental performance fixes that sort of thing and then the major is for when you break something. What does it mean to be releasing bugs but rather like changing the API surface in a way that you may or may not have incompatibility with whatever you're working on. Rose by the way, explicitly is not using semantic versioning exactly. They have that learn switch of like brushing scheme that you can go to look up if you're interested in how it works, but pretty
David showed us the full text of the MIT license and he focused specifically on a different paragraph to this one. He focused on the responsibilities that uses of this paragraph is the responsibilities that maintain is have the software is provided as is without warranty of any kind Express or implied including but not limited to warranties of merchantability Fitness for a particular purpose another another clothes that don't cough have That's a pretty bleak. Right? What is basically saying? Is that a maintainer of an ocean. A kid can just reach you at any time
for any reason and complaining head. This is like a fair trade for the fight. The oldest software is free and you can still in traffic ations, however, and whenever you want But this combines with semantic versioning to give us the sort of contract that all I would give to us. We use semantic versioning to hedge around this particular thing. I want to talk a little bit more deeply about how breaking changes walk and to do. So I'd like to consider this function really mess up whenever times the number
123. Well if I changed over time signature of this function for kind of string 123, is this a breaking change? Well the types of changed so there are certainly some situations which in Butterfingers function will no longer have the same day. But what if I told you that the author of the library had intended for this function only be used in any way until spring into a place in the volume. It doesn't matter if he likes present perfectly safe Behavior change to make Let's look
at another function computation is the integer 123. What if I change it to a string that is this a breaking change? Well, this function has the word count in its name. I'm sorry. I would probably argue that changing a function that has something to do with counting from returning an integer to a string is a wildly unexpected Behavior, but let's suppose for a second. There's two functions what completely identical apart from their names, right? All I did was change the name from stasis message to count rows
in one case. We said it was breaking change in the one case. We argued it wasn't. The point isn't like objects and Ruby can be used in several different operations. Right? We have to S identity math all kinds of functions. They want kinds of objects contacts Know. Jack is going to be used in it's hard to reason about whether or not braking change is going to be made when you change something about how the system works another way of saying this is the braking actually, be defined by a purely source code bases does no mechanical process that you can go through
to analyze all between changes insoles code and determining whether or not they're breaking change like the Alexa Community The Hub tools Like Walter December that actually do this web basically anytime a type signature on a function changes. They cause bumps the major push it but to me that doesn't seem like a good fit Ruby libraries because we make these kinds of changes all the time and we communicate in context about whether or not those changes a safe. Flip come back to compatibility. We talked about semantic versioning an abstract and see how it changes
and we forgetting to get this I did like compatibility comes not just indicated that we walk on but also context and other words compatibility isn't a technocratic thing like old good computer problems. That's actually a hard people problem underneath and it's a hard people problem deciding whether or not to communicate in 10 thing is that you was the author of a library of declaring something about what you intend that uses of your library to receive when you install that
version. Another way of writing. This is the semantic versioning is a mechanism for communicating intent. It's not a technocratic process that you have to go through when you change and brush and you'll like it's a way of you the author of a library thinking about and considering what the impacts of your changes are going to be and then coating it into a system that can be understood by computers Fashions lexicographically sortable, which is a fancy way of saying big of Russians come lost into a sort ordering and what that means is that you was the author
increment them exactly with intent to decide whether or not you broken what your uses of doing. Philosophical high-level, what even is Denver the semantic versioning guarantee of us? Because being the between a major we will never break your test and like that would be a fairly bad thing for testing framework to do if you are greater than mine and suddenly all of your tests were broken that wouldn't be so great. And so if you have a pen to all spec 3.0 what we're saying to you is all spec will not under any circumstances break your tests as long as you're not changing any of the other
stuff out from underneath us. And that's that's a bustling strategy right that tells us what we need to do in correctly Russian off back and it tells you what you need to do to make sure that you'll test on going to break when you update your affectations. I'd like to know just a little bit about how often constructed and how this is going to change. So this is the basic dependency diagram of off back when you say gem off back. You're not actually guessing any colored within the office pajamas self-respect is made up of a series of other gems the functions independent
libraries When You Sage a moth but it depends on outside cool and I'll smack expectations. Those are entirely independent libraries that just happened to walk well together to create the entire house by testing framework. For example, if you're struggling to get him walk. In quite the right place, you can pull it off back mugs as an alternative mocking Library integrate with many tasks and all of your like mocking capabilities will some leaves but this is true about Libras. So true true for all spec cool which library for structuring a
complex and compound volume on shows the pentagram for office looks like this but we also have off bike trails and rails is a separate library that you install if you want to touch your real that place is in the room, right? Whales is different it actually contains a whole bunch of real specific code that enables us to like link up against rails his various testing Frameworks and it would let you do things like requests execute system tests test your models and so on and off.
Dependency if you guys ruby gems what you'll see is the effect or affect Mark's friend at 3.8 Point some pop bottle when we release the effect libraries today. We release them in lockstep Russian, even if there's no enhancements or fix it in one of the libraries, we release them all together so that they into the pain and get the latest version of everything from each other. You can buy this with the fact that the hasn't been in Need for Norfolk major in nearly four years and you got to run from 32313 to and so on all the way through the 3/8 series
the office if you guys are fairly stable. We haven't seen much in the way since we did all lost breaking change release while we felt the need to remove apis that could potentially break people's tests. I've been thinking about this a little bit recently because I show you the dependency diagram of all spec in all spec rails. And the thing is this section right here is really the problem. Since we released off back 3 the entire rails 5 series and now rail 6 is
around the corner. They released, you know, you said party dependencies. They don't have anything external that they need to depend on but well Hills is a moving Target. They release really quickly in. Grateful of us in the room. This is a picture of the current versions of rails of a signed today 5.2 receives bug fixes and security patches 5150 in full to receive security patches and really soon but at the time when Effect 3 was released, we also supported for one and Ferrari. +
3231 + 3 and because we haven't released and I'll expect major since we did that we still support rails is all the way back to 300 and Ruby's all the way down to 187. That's what a lot of emotions and rails West in simmesport and you maybe I'll see yourself. Why on Earth are you doing this? Reasonable question. Well, as I said, we haven't had a reason other than this to dropping you off with major in the last 4 years and it's not like those libraries. Let's play Rock Lee actually couples
and so I decided that the thing we actually need to do is change all the shooting strategy. I'm sorry look like and I saw you build consensus within the team. I'm not the only aspect lead maintain other or two of us. It's making lead very weird title. And then their whole host of other I wasn't just going to do this unilaterally I needed to actually talk to people and make sure this was a good idea. So I wrote this RFC off. Corral's needs a new washing strategy in this outline of what we're going to do, but the primary point
with this me and change of representation of what we used them before in office bag, and this is a What's a reasonable thing to do? I think more Library. If you have an explicit description of what they going to use semantic versioning 4in how they look into outline a strategy has four points. The first one is very broad. It says bike trails will now be the Russians separately to the rest of us back basically off at Brazos hamstrung today by the fact that has to stay in lockstep major with the other version of off back porch don't need to release
Majors all that quickly. Then I proceeded to find what a major version actually is really some major with rails major break things. We going to break the versions of rails that now and support it really is my nose with rails and Bubbles basically should always just released past levels as quickly as you can because they have bug fixes and Bug fixes are extremely low cost. I think every Library should have a clear and stable definition of what braking change is so that you know, whether or not you're actually breaking someone I use it. I think it's really
interesting cold Ruby format right now. I'm one of the very first things I did when I wrote the issue template, I'd like to find what a breaking change was this let's just make sure uses have a good understanding of when we go into brake dust off. I'm sorry, we implemented this new Russian tank strategy and I just kind of want to walk through quickly through branching and development strategy. This is now family in the weeds of how I'll smack is actually developed a major Russian brunch this started by the way at the beginning of this year on
this on the 19th of January, which was just before I joined Google the funny thing about having like a long-running development projects. You can do a lot of work that might not be safe to do on your mouth does. So the first thing I did is delete every Royals motion that we want during child support and this is a nice blood red death. I love it when you can just delete tired of great. You wait, and you wait and you wait for the rails cool team to actually release the release candidate for L6 which happens like a week and a half ago. So I had to do a friend's friend to
a piece of development would like to get everything ready for this talk so I can actually talk about the new off a question that I'm talking about and just talk if that makes any sense. Then you add that Rail Rush into your Travis Matrix and fix like just so many bugs just so many bugs. And today we have a betta a Bostitch rails for you can pull down from ruby gems immediately had the Beatles. There I think 15 total minutes before I realized it didn't walk. Good job.
That's kind of the development Story the same bus story now. It's time for me to dramatically read the effect changelog at you as I do every year or else called dropping. All of these rails is in all of these rubies. You can't read it because there was so many out of Travis Matrix that I had to minimize my browser all the way down. This is 3.0 + reviews 2017 up now. I'll try to make sure it's looks like this and you might actually be able to read it at your place in the front seat in Rossville. Fire. Fire is no longer supported the
currently supported versions of Ruby and rails for cheer for the longest time, and I didn't want to do a sudden knee Chuck breakage. Sorry rails for .22 will be slight against in the final build of a crowd full point 0.00 Loft Boston butt at off the bat. Feel like I belonged to this by the way is that there were literally zero changes in the actual production code of the Janet was old build stuff and Sophia rustically you can still use all spec trails with rails three, but please stop using rounds 3. It's really bad at this point
and then going for a current and previous rails. Majors will be supported 6 and 5 will be supported when 7 comes out at some point in the future 76 and so on we are not supporting j2ee, but the first time in many years, I'm actually really happy about to announce. I'll start now supports jruby. Thank you. Jruby with his be unsupported by Outback for the last four years. I was able to meet up with child filter in a bar at Ruby Heidi and sit down with them and get it walking. So we now see I against a ruby. I'm really pleased about this because jruby is kind of a
big deal with the rest of us back in line with rails inside of a line with offset. This makes much more sense for us back to the library. But this is a question what happens with the next off bike major? I told you the quote him about this and like we don't know if we're ever going to make like Mainline all spec for like we don't get that many complaints that would require breaking changes for us to release. So I will support it but I don't know if that's going to happen.
But we really need your help affect rails not received as much attention as it needs and icon on my own and with the rest of the maintainers give it everything. We need really we haven't implemented support for new Royal feature in a couple years basically decent System test and I could really just do with someone to come along and help me with that. We really need attention on these things bug fixes piling up and it's not great. But if you look at the flick of
a bug or even fix it, I would be super If you're interested in actually like doing some full-time walk on off back, please no full-time, but like continuous walk and I'll sec. Please come up to me and let's have a chat. We really really need some help. That's all I got. Thank you so much. I'm at some type in. My email address.
Buy this talk
Access to all the recordings of the event
Buy this video
With ConferenceCast.tv, you get access to our library of the world's best conference talks.