Tina Barfield
2013-Nov-19 21:03 UTC
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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/23561972-0faa-47f7-9531-a511866ad294%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
angela ebirim
2013-Nov-20 07:22 UTC
Re: Noob to rails TDD - looking for just one complete and simple example.
You might find something here http://railsapps.github.io On 19 November 2013 21:03, Tina Barfield <tbarfield-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 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 received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/23561972-0faa-47f7-9531-a511866ad294%40googlegroups.com > . > For more options, visit https://groups.google.com/groups/opt_out. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL_gTQELfHig3XwGKyrSAxYKhzCAQPUNUXDqoJ202_VF4jnO0g%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Tina Barfield
2013-Nov-20 12:50 UTC
Re: Noob to rails TDD - looking for just one complete and simple example.
@trekr67 Thank You for the feedback. This site will be useful, but unfortunately doesn''t address this specific request. Thank you. On Wednesday, November 20, 2013 2:22:43 AM UTC-5, trekr67 wrote:> > You might find something here http://railsapps.github.io > > > On 19 November 2013 21:03, Tina Barfield <tbar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>>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 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 = Doclist.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 received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-ta...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. >> To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<javascript:> >> . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/rubyonrails-talk/23561972-0faa-47f7-9531-a511866ad294%40googlegroups.com >> . >> For more options, visit https://groups.google.com/groups/opt_out. >> > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/078b2313-1726-4fa0-9b8d-61a3e407f2cd%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2013-Nov-20 13:45 UTC
Re: Noob to rails TDD - looking for just one complete and simple example.
On 19 November 2013 21:03, Tina Barfield <tbarfield-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuzcd%2BWG67Jm%2BHpaW2vRY%2Byw9KyH5djdj%3D4uU1bMVmO1Q%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Tina Barfield
2013-Nov-20 22:27 UTC
Re: Noob to rails TDD - looking for just one complete and simple example.
@Colin Thank you for the post, this is very helpful. On Wednesday, November 20, 2013 8:45:45 AM UTC-5, Colin Law wrote:> > On 19 November 2013 21:03, Tina Barfield <tbar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> > 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 >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/dd355084-6292-4427-93c4-21598b26dc87%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.