how would I go about 'starting over from scratch' with Rails tests?

I have an existing Rails app that I built using Rails 3, Mongoid/Mongodb and Devise. The app is running fine. I'd now like to add some tests to it (sure, shoulda done this in the beginning but the learning curve for just Rails was enough...).

I've used several pages to get it going, especially the Rails guide and this blog post about Mongo and Cucumber/Rspec. My concern here is that between all of the "add this to this and such file" that I've done to try and get this working (and it's not) I've made such a mess of things that it might be better to start over from scratch. With the testing portion of the app.

I thought I would just delete the spec and test directories and re-gen the tests but I can't find a command to do that (the regen).

I've built a very simple test (assert true) but I'm getting:

D:/Dev/TheApp/test/test_helper.rb:10:in `<class:TestCase>': 
undefined method `fixtures' for ActiveSupport::TestCase:Class (NoMethodError)

I think the real issue here is that I'm using MongoDb and the test architecture in Rails seems to really really want to do ActiveRecord. Not sure if those two are compatible.

Is there a quick way to build a barebones test directory? My short term solution is to just roll back those directories. Hoping for a better solution.

Answers


The blank tests are really worthless. If you didn't have tests/specs of value, then just start from scratch. And if you want to start over, you should just delete them and start new.

You could treat your code as "legacy code" as defined by Michael Feathers in Working Effectively with Legacy Code -- that is, code without tests.


Take a look at this getting started with rails testing guide over at 10gen:

http://www.mongodb.org/display/DOCS/Rails+-+Getting+Started#Rails-GettingStarted-Testing


Need Your Help

eBay API GetSessionID method not returning session ID

c# .net ebay ebay-lms

I am using eBay API to call GetSessionId method but the method returning me the empty SessionID in my ASP.NET MVC4 application.

How to implement OAuth2 in Jersey?

oauth-2.0 jersey jax-rs

I developed a JAX-RS project. I used Jersey for it. I'm trying to figure out what's the best solution for authentication, since my API will be consumed through a web and a mobile application.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.