Jump to content

The ultimate community for Ruby on Rails developers.


RSpec and using --no-test-framework?

  • Please log in to reply
4 replies to this topic

#1 Stuart Hannig

Stuart Hannig


  • Members
  • 15 posts

Posted 26 August 2013 - 04:04 PM

The two tutorials that I have managed myself through state to add --no-test-framework when adding controllers to the app. This is to prevent test stubs from being auto created. I understand that.


Do you guys add this command everytime you use the generate controller command?


Is there a way to auto add it so I don't have to worry about forgetting it? Is that a bad idea? How to you handle your testing files when using RSpec? Please share your practices.

#2 james



  • Members
  • 223 posts
  • LocationLeeds, U.K.

Posted 26 August 2013 - 11:39 PM

I don't use the --no-test-framework flag as I like to be reminded that I have pending tests. If I am being ultra efficient and writing my tests first (TDD) then I just delete the generated test files when I am happy that I have the test coverage I need in my integration tests.


It's a personal thing and you'll probably get lots of different answers.


Pick a way, use it, then try out different ways until you find something you are really comfortable with.


So long as you are testing it doesn't really matter how you test.

Programming is just about problem solving!

#3 Kelli Shaver

Kelli Shaver


  • Administrators
  • 76 posts
  • LocationKentucky

Posted 08 September 2013 - 11:46 PM

I can't bring myself to do TDD unless I'm working on an existing project that uses it - I know how, I can, I just don't like it. It makes coding feel like a constant, uphill battle in which I'm always fixing broken things, instead of creating something new.


I do like to have really good test coverage, though. Like James, I like being reminded that I have pending tests and if, for some reason, I don't intend to test something that's "pending," I'll make a note of why in the spec file.

  • Rowel likes this

#4 Rowel



  • Members
  • 109 posts

Posted 09 September 2013 - 01:28 AM

As a beginner learning Rails, I feel TDD testing to be a hindrance. I want to get my head around it, tried writing some basic tests, but feel it's a waste of time for me at this point.  I'd rather learn Rails first, than TDD testing. 


Learning rspec tests, learning the ins and outs of capybara, FactoryGirl, etc.... when you're still learning Rails, I feel it's just too much.  I feel like I'm just spinning my wheels. 


I don't know if it's my Rails app that has an error, or the rspec script I wrote has the error, or the test is not effective for TDD testing to be useful for me at this stage of my learning. And writing tests that's just a bunch of "pending" reminders, well, it's not useful testing anyway -- for me. 


Once I know and gain more experience with Rails, then maybe I'll know what to test for, and how to test for it. So for now, I've shelved TDD testing. 

#5 Kelli Shaver

Kelli Shaver


  • Administrators
  • 76 posts
  • LocationKentucky

Posted 09 September 2013 - 08:49 AM

I think writing tests could be useful, but probably not TDD for the reasons you mentioned (is it the app code, or is it the test that's breaking?). Code something, test it in your browser and see that it works, then write a test for it. I feel like it's a practical way to learn the workings of your testing framework of choice. 


Knowing how/what to test for and what makes a good test is another matter entirely. Check out http://betterspecs.org - there's some really good info there. 

  • Rowel, rayray and orrymr like this

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users