Noob to rails TDD - looking for just one complete and simple example

I am a noob to TDD, and I am looking for just one complete and simple
example, that uses FactoryGirl, with rspec, on rails, with a
ActiveRecord::Base model.

If anyone can help me I will be eternally in your dept.

For example:

I have a page that displays a list of file names based on category.

Test:

If the category is good the list of names (@list_of_names) should not be
nil

Model (app/models/doclist.rb)

class Doclist < ActiveRecord::Base

self.table_name = 'mydbo.dbo.doclist'

self.primary_key = 'id'



attr_accessible :id, :name, :catname, :catid

end

Call from the controller (app/controllers/general_controller.rb)

@list_of_names = Howto.where(“catid=10”)

What code would I put in these files?:

spec/factories.rb

spec/models/Doclist_spec.rb

app/controllers/general_controller.rb

app/models/doclist.rb

Am I missing something?

You might find something here http://railsapps.github.io

@trekr67 Thank You for the feedback. This site will be useful, but
unfortunately doesn’t address this specific request. Thank you.

@Colin Thank you for the post, this is very helpful.

On 19 November 2013 21:03, Tina B. [email protected] wrote:

I am a noob to TDD, and I am looking for just one complete and simple
example, that uses FactoryGirl, with rspec, on rails, with a
ActiveRecord::Base model.

If you work right through the tutorial at railstutorial.org (which is
free to use online) that should get you started with rspec and
factorygirl.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs