small medium large xlarge

16 Feb 2017, 02:33
Askarbek Karasaev (45 posts)


Gem installation shown from command line.

But I think it’d be also useful for newbies to see how and where in Gemfile we would place rspec gem.

Is is possible to include this in next update?


16 Feb 2017, 06:33
Myron Marston (15 posts)

We do show usage with bundler in part 2 (including showing where to list the gem in the Gemfile, as you asked), where we walk through building a JSON API. In the context of a project, using bundler definitely makes sense. For Part 1 we are just focused on playing with RSpec in isolation, without any other gems or anything like a realistic project. In that context, we felt like it was simpler to just gem install rspec–no need to involve bundler at all.

Does that make sense? Do you still think we need to mention bundler in part 1 even though we don’t plan to use it until part 2?

16 Feb 2017, 15:35
Kenrick Chien (1 post)

I don’t think introducing Bundler is necessary, to make it easier for beginners to follow along.

05 Mar 2017, 17:45
Ian Dees (212 posts)

Welcome, Ken!

Indeed, most of the examples in the book are designed to work with just plain RSpec, outside of a Rails app. The advice we give—testing the exact parts of the code you intend to, focusing on readability and maintainability, and making tests pay for themselves—will apply to both Rails and non-Rails projects.

We plan to cover the basics of Rails integration later, but not in great detail. Most likely, we’ll cover installation and the few things that make an RSpec-Rails project different than an RSpec-only project.



05 Mar 2017, 21:29
Myron Marston (15 posts)

My only question/issue is I don’t want install to interfere with any of my other rails projects…

As long as you use bundler for those rails projects, you shouldn’t have any problems. Bundler exists specifically to give each project an isolated sandbox of gems, so that an installation of a gem for one project cannot cause any problems for other projects.

05 Mar 2017, 21:38
ken mcfadden (4 posts)

Appendix addendum: Rspec under the covers Would it be possible to add a chapter going thru what happens under the covers of a spec? As an example, while doing specs I was always wondering…“Is my controller code executing line for line? Or is it some combination with my spec? And what is the order.

A specific question I had…how come in my Controller I define @variable(an instance variable) but it seems like in my expectation, it does not care if I have the @ sign. Is there some code that is making that work?

I got things to work by playing around sometimes, but not sure why. I think understanding some of the mystery as to how the thing actually works (this is a method, that calls this method…that does the compare) would be beneficial.

Thanks in advance.

07 Mar 2017, 05:49
Ian Dees (212 posts)

Hi, Ken.

One of our goals with the upcoming Rails content is to show the conveniences RSpec-Rails provides for testing controllers, models, and views. We won’t have room to give line-by-line detail of what RSpec is doing behind the scenes, but we should at least be able to show how the control flows between RSpec and your controller code.



You must be logged in to comment