Re: [rspec-users] Do you still Write Tests First on code that is churning hard?

2010-02-22 Thread Chuck van der Linden
> > Date: Sun, 21 Feb 2010 10:37:14 + > From: Andrew Premdas > To: rspec-users > Subject: Re: [rspec-users] Do you still Write Tests First on code that >is churning hard? > Message-ID: ><88fd8ddc1002210237m39085abbo6c43a7dc34130...@mail.gmail.com> > Content-Type: text/pla

[rspec-users] Best approach to spec'ing this

2010-02-22 Thread Matt Riches
I am hoping that this is an easy question to answer! I have 2 models, related via an association model, such that models a and b use has_many to refer to each other, and also the association. (Thats as simple as the code is) When I try to write a simple spec to access model 2 from model 1 I am g

Re: [rspec-users] Best approach to spec'ing this

2010-02-22 Thread Andrei Erdoss
What I do is to mock and stub the associated models. The current model that I work on is called, usually using a Factory Girl. Hope this helps. On Mon, Feb 22, 2010 at 8:54 PM, Matt Riches wrote: > I am hoping that this is an easy question to answer! > > I have 2 models, related via an associati

[rspec-users] Module instance variable remains set

2010-02-22 Thread Harm
Hi, I have an issue with rSpec when spec'ing a module. The module in question looks like this: module Sheep def self.sound @sound ||= produce_sound() end end This module is used all around the application (and corresponding specs) and somehow values of @sound leak between each spec. The

[rspec-users] Check out my shelves

2010-02-22 Thread Pat
Hi rspec, Check out the books I added on Goodreads. http://www.goodreads.com/friend/i?n=rspec users&e=rspec-us...@rubyforge.org&i=LTM2MDQzNDk4OTE6MzY4 - Pat (pat.ey...@gmail.com) Goodreads is a community for book lovers. It's a great way to get book recommendations from your f

Re: [rspec-users] Module instance variable remains set

2010-02-22 Thread Harm
Addendum: I'm using rspec 1.3.0, rspec-rails 1.3.2 and ruby 1.9.1p129 On Feb 22, 8:45 pm, Harm wrote: > Hi, > > I have an issue with rSpec when spec'ing a module. The module in > question looks like this: > > module Sheep >   def self.sound >     @sound ||= produce_sound() >   end > end > > This

Re: [rspec-users] Best approach to spec'ing this

2010-02-22 Thread Scott Taylor
On Feb 22, 2010, at 1:54 PM, Matt Riches wrote: > I am hoping that this is an easy question to answer! > > I have 2 models, related via an association model, such that models a and b > use has_many to refer to each other, and also the association. has_many :through with an extra table, or HABT

Re: [rspec-users] Best approach to spec'ing this

2010-02-22 Thread Matt Riches
> > > I am hoping that this is an easy question to answer! > > > > I have 2 models, related via an association model, such that models a and > b use has_many to refer to each other, and also the association. > > has_many :through with an extra table, or HABTM? > > Im home now and dont have the code

Re: [rspec-users] undefined method `has' in integration test

2010-02-22 Thread drewB
Any thoughts on how to get the matchers included? On Feb 21, 4:23 pm, drewB wrote: > I require webrat in spec_helper (Spork.prefork). > > versions: > > rails 2.1.2 > rspec 1.3.0 > rspec-rails 1.3.2 > ruby 1.8.7 > > The file is located at 'spec/integration/landing_page/ > Ianding_page_spec.rb'. I

Re: [rspec-users] Module instance variable remains set

2010-02-22 Thread Matt Wynne
On 22 Feb 2010, at 19:45, Harm wrote: Hi, I have an issue with rSpec when spec'ing a module. The module in question looks like this: module Sheep def self.sound @sound ||= produce_sound() end end This module is used all around the application (and corresponding specs) and somehow values

[rspec-users] Of ActiveRecord, arel, and train wrecks

2010-02-22 Thread Rick DeNatale
I thought that it might be worth starting a discussion about the best approaches to deal with spec'ing what's becoming more and more common in apps using active record. It started with named scopes, now we have arel, and the old find calls with parameters are being deprecated. When I watched Ryan

Re: [rspec-users] Of ActiveRecord, arel, and train wrecks

2010-02-22 Thread Scott Taylor
On Feb 22, 2010, at 6:07 PM, Rick DeNatale wrote: > I thought that it might be worth starting a discussion about the best > approaches to deal with spec'ing what's becoming more and more common > in apps using active record. > > It started with named scopes, now we have arel, and the old find ca

Re: [rspec-users] Of ActiveRecord, arel, and train wrecks

2010-02-22 Thread Rick DeNatale
On Mon, Feb 22, 2010 at 6:16 PM, Scott Taylor wrote: > I haven't spent enough time with it yet to know, but I suspect that surface > mocking (what is usually called stubbing in this community) is going to get > harder with the demeter violations. > One of the things that I tend to do, is to no

Re: [rspec-users] Of ActiveRecord, arel, and train wrecks

2010-02-22 Thread Pat Maddox
>From a mocking / stubbing perspective, how is this different from Article.all(:conditions => ['published_at <= ?', Time.now], :include => :comments) ? i.e. in both cases wouldn't you do class Article def self.active_published all :conditions => ['published_at <= ?', Time.now], :include =>

Re: [rspec-users] Rails3 + RSpec2 sample project?

2010-02-22 Thread anywho
I'm using this setup with rails 3/1.9.1 and this aforementioned gem. However, when running rake spec, I get this error: no such file to load -- test/unit/assertionfailederror seems 1.9.1 no longer has this file. I tested running it with commenting out this requirement and simply adding the below