Re: [rspec-users] Rspec approach to test model

2009-02-11 Thread Kaleem Ullah
Hi all, Below is my model action. def activate! self.update_attribute(:active, true) end here is spec/models/user_spec.rb describe User do before(:each) do @user=User.new(:email=>'k...@gmail.com',:password='1234',) end This is my spec. it "should activate the user" do @user.a

Re: [rspec-users] Rspec approach to test model

2009-02-11 Thread Phlip
Kaleem Ullah wrote: Scott Taylor wrote: You could benefit from a factory / data builder. See FixtureReplacement, Fixjour, Factory girl, one of the many others out there which would build this stuff *once* for you. I am in need of such data builders. I recently thumped the square peg of

Re: [rspec-users] issues with the trunk of rspec-rails

2009-02-11 Thread David Chelimsky
On Wed, Feb 11, 2009 at 2:52 PM, nat...@pivotalsf.com wrote: > On Feb 10, 8:49 pm, David Chelimsky wrote: >> On Tue, Feb 10, 2009 at 2:02 PM, Nathan Wilmes >> wrote: >> > (4) assigns(:xxx) will give really bad errors if your class doesn't happen >> > to define == in such a way that it can equat

Re: [rspec-users] [RSpec] rcov and/or rexml bug?

2009-02-11 Thread Rob Sanheim
On Sat, Feb 7, 2009 at 12:06 PM, Fernando Perez wrote: > >> So I uninstalled rcov, and installed instead: spicycode-rcov, but now it >> cannot find the binary file. Using spicycode do I need to make any tweak >> to a rake file? > > I finally got everything working with no bugs by doing: > > 1) git

Re: [rspec-users] issues with the trunk of rspec-rails

2009-02-11 Thread David Chelimsky
On Wed, Feb 11, 2009 at 2:52 PM, nat...@pivotalsf.com wrote: > On Feb 10, 8:49 pm, David Chelimsky wrote: >> On Tue, Feb 10, 2009 at 2:02 PM, Nathan Wilmes >> wrote: >> > (2) The render override for RSpec controllers only takes one argument. >> > This >> > means that any controller using two

Re: [rspec-users] How to test the code inside the block of the to_xml function?

2009-02-11 Thread David Chelimsky
On Fri, Feb 6, 2009 at 3:12 PM, Alex wrote: > Hi all, when I spec the to_xml function like this: > @some_model.should_receive(:to_xml), it dskips the code located in the > block, here is the controller code: > > ... > output = @detenteur.to_xml( :skip_types => false, :skip_instruct => > true, :das

Re: [rspec-users] issues with the trunk of rspec-rails

2009-02-11 Thread David Chelimsky
On Wed, Feb 11, 2009 at 2:52 PM, nat...@pivotalsf.com wrote: > On Feb 10, 8:49 pm, David Chelimsky wrote: >> On Tue, Feb 10, 2009 at 2:02 PM, Nathan Wilmes >> wrote: >> > (3) with_tag is completely broken, as it tries to use the outer class as >> > the >> > subject of 'with_tag', rather than t

Re: [rspec-users] How to spec within a block?

2009-02-11 Thread Remi Gagnon
It works thanks for the hints Rémi On Wed, Feb 11, 2009 at 8:21 PM, Pat Maddox wrote: > On Sat, Feb 7, 2009 at 3:47 AM, rgagnon wrote: > > I have this and I want to mock the to_xml but not his block cause this > > is what I want to spec. Is there a way to do this? > > Use and_yield to yield a

Re: [rspec-users] Weird message on ActiveSupport::Callbacks::CallbackChain:Class

2009-02-11 Thread Remi Gagnon
Thank you David, You are right we are dealing with some code that need to be refactored. We will dig deeper to have more info about this Callbackchain problem Rémi On Wed, Feb 11, 2009 at 12:05 AM, David Chelimsky wrote: > On Tue, Feb 10, 2009 at 9:03 AM, Remi Gagnon wrote: > > Hi guys, > > >

Re: [rspec-users] How to spec within a block?

2009-02-11 Thread Pat Maddox
On Sat, Feb 7, 2009 at 3:47 AM, rgagnon wrote: > I have this and I want to mock the to_xml but not his block cause this > is what I want to spec. Is there a way to do this? Use and_yield to yield an object, and you can set expectations on it. For example: xml_detent = mock('xml detenteur') xml_

Re: [rspec-users] exemplary way to show a list is sorted?

2009-02-11 Thread Pat Maddox
On Wed, Feb 11, 2009 at 6:52 AM, James Byrne wrote: > Further, by its very nature, a tool is used by vastly more people than > those that create the tool, otherwise it has little value. The idea > that a large number of people should be inconvenienced in order that a > few people are not strikes

Re: [rspec-users] issues with the trunk of rspec-rails

2009-02-11 Thread nat...@pivotalsf.com
Snipping down to relevant questions: On Feb 10, 8:49 pm, David Chelimsky wrote: > On Tue, Feb 10, 2009 at 2:02 PM, Nathan Wilmes wrote: > > (2) The render override for RSpec controllers only takes one argument.  This > > means that any controller using two argument forms will fail. > > > Our b

Re: [rspec-users] exemplary way to show a list is sorted?

2009-02-11 Thread Matt Wynne
On 11 Feb 2009, at 16:53, James Byrne wrote: David Chelimsky wrote: I explained my position in another post in this thread, and I look forward to your *respectful* responses to those thoughts. I regret if my initial observation was taken as anything other than that, an observation. One mig

Re: [rspec-users] Cucumber - How to enable a disabled field

2009-02-11 Thread Joseph Wilk
I would highly recommend you take a look at Celerity (http://celerity.rubyforge.org/) as well. The Culerity gem has made it easy to run Celerity (using jruby) alongside your normal ruby app. http://upstream-berlin.com/2009/01/28/culerity-full-stack-rails-testing-with-cucumber-and-celerity/ S

Re: [rspec-users] Rspec approach to test model

2009-02-11 Thread Kaleem Ullah
Scott Taylor wrote: > On Feb 11, 2009, at 8:51 AM, Kaleem Ullah wrote: > >>@user=User.new >>@user.active= '1' >>@user.reset_password_token= '' >> end > > You could benefit from a factory / data builder. See > FixtureReplacement, Fixjour, Factory girl, one of the many others out > th

Re: [rspec-users] Rspec approach to test model

2009-02-11 Thread Kaleem Ullah
Nick Hoffman wrote: > To spec your #activate! , why not do something like this?: > > it 'should activate the user' do >@user.active.should be_false >@user.activate! >@user.active.should be_true > end > > Thanks for your reply Hoffman :) I did the same but it gives error like "#230

Re: [rspec-users] exemplary way to show a list is sorted?

2009-02-11 Thread David Chelimsky
On Feb 11, 2009, at 10:53 AM, James Byrne wrote: David Chelimsky wrote: I explained my position in another post in this thread, and I look forward to your *respectful* responses to those thoughts. I regret if my initial observation was taken as anything other than that, an observation. On

Re: [rspec-users] Rspec approach to test model

2009-02-11 Thread Kaleem Ullah
James Byrne wrote: > I recently installed nakajima-acts_as_fu (0.0.3) gem. This provides a > rather painless way of specifying ActiveRecord model schemata on the fly > in your specifications. You might find it helpful to look into this. > > You will discover that some people favour mocks and

Re: [rspec-users] Rspec approach to test model

2009-02-11 Thread James Byrne
Scott Taylor wrote: > On Feb 11, 2009, at 8:51 AM, Kaleem Ullah wrote: > >>@user=User.new >>@user.active= '1' >>@user.reset_password_token= '' >> end > > You could benefit from a factory / data builder. See > FixtureReplacement, Fixjour, Factory girl, one of the many others out > th

Re: [rspec-users] exemplary way to show a list is sorted?

2009-02-11 Thread Nick Hoffman
On 10/02/2009, at 10:09 PM, James Byrne wrote: Zach Dennis wrote: On Tue, Feb 10, 2009 at 6:22 PM, James Byrne wrote: David Chelimsky wrote: please use "should be >=" as "should >=" will eventually be deprecated and removed. Removed? You are not seriously contemplating forcing people

Re: [rspec-users] Bizarre problem with Rake / Rcov

2009-02-11 Thread James Byrne
David Chelimsky wrote: > On Tue, Feb 10, 2009 at 5:24 PM, James Byrne > wrote: >> t.rcov_opts << r_rcov_opta >> >> sigh... > > Sorry - not following - does this mean you solved the problem? Yes, a beginners error I am afraid. a = [1, 2] b = a b << [3,4] a => [1,2,3,4] -- Posted via h

Re: [rspec-users] Rspec approach to test model

2009-02-11 Thread Scott Taylor
On Feb 11, 2009, at 8:51 AM, Kaleem Ullah wrote: Hi, I am quite new to Rspec. I want to use Rspec to test my existing Code. I start from Models (Unit Testing). Here i want your help on a issue. Here is model/user_spec.rb describe User do before(:each) do @user=User.new @user.id='2

Re: [rspec-users] Rspec approach to test model

2009-02-11 Thread Nick Hoffman
On 11/02/2009, at 8:51 AM, Kaleem Ullah wrote: Hi, I am quite new to Rspec. I want to use Rspec to test my existing Code. I start from Models (Unit Testing). Here i want your help on a issue. Here is model/user_spec.rb describe User do before(:each) do @user=User.new @user.id='2'

Re: [rspec-users] exemplary way to show a list is sorted?

2009-02-11 Thread James Byrne
David Chelimsky wrote: > > I explained my position in another post in this thread, and I look > forward to your *respectful* responses to those thoughts. I regret if my initial observation was taken as anything other than that, an observation. One might consider it the textual equivalent to a

Re: [rspec-users] exemplary way to show a list is sorted?

2009-02-11 Thread David Chelimsky
On Wed, Feb 11, 2009 at 8:52 AM, James Byrne wrote: > Zach Dennis wrote: > >> >>> Such action causes avoidable and pointless work. >> >> And to disprove this argument I will defer to the avoidable and >> pointless work you will be causing those who maintain the software, >> > > This is a completel

Re: [rspec-users] Cucumber - How to enable a disabled field

2009-02-11 Thread Tom Hoen
Pat Maddox wrote: > You have to go through the browser, using something like selenium > (which can be driven by cucumber) > > Pat Since I only have this one little widget on the page, I was hoping to avoid selenium for now, but alas. Will give it a go. Thanks for your thoughts. Tom -- Posted v

Re: [rspec-users] [cucumber] [alpha] The Backgrounder is run without cleaning up

2009-02-11 Thread Chris Flipse
Okay, thanks. Wanted to check before filing a bug so I'm not throwing duplicates into the mix. On Wed, Feb 11, 2009 at 2:56 AM, aslak hellesoy wrote: > On Wed, Feb 11, 2009 at 2:10 AM, Chris Flipse wrote: > > This /could/ just a screwy behavior I'm seeing in SQL lite, but I don't > > think so;

Re: [rspec-users] exemplary way to show a list is sorted?

2009-02-11 Thread James Byrne
Zach Dennis wrote: > >> Such action causes avoidable and pointless work. > > And to disprove this argument I will defer to the avoidable and > pointless work you will be causing those who maintain the software, > This is a completely illogical, and inherently contradictory, statement. The iss

[rspec-users] Rspec approach to test model

2009-02-11 Thread Kaleem Ullah
Hi, I am quite new to Rspec. I want to use Rspec to test my existing Code. I start from Models (Unit Testing). Here i want your help on a issue. Here is model/user_spec.rb describe User do before(:each) do @user=User.new @user.id='2' @user.email='k...@gmail.com' @user.password

Re: [rspec-users] Problem with refresh_specs

2009-02-11 Thread David Chelimsky
On Sat, Jan 31, 2009 at 12:45 AM, jschank wrote: > Hello, > I recently unpacked the latest (1.1.12) rspec and rspec rails in my > applicaiton. Manually? Or using "rake gems:unpack"? > When I run my specs I get: > > config.gem: Unpacked gem rspec-1.1.12 in vendor/gems has no > specification file.

Re: [rspec-users] Best way of writing fetaures for a wizard

2009-02-11 Thread Matt Wynne
On 11 Feb 2009, at 09:38, Lucas Florio wrote: Hi everyone, I am Lucas and I am starting to use cucumber in project. I need to write a scenario that is little bit complex. Lets suppose I have a Thing and then I need to advance that Thing through 4 stages (something like 'import', 'validatio

Re: [rspec-users] Best way of writing fetaures for a wizard

2009-02-11 Thread David Chelimsky
On Wed, Feb 11, 2009 at 3:38 AM, Lucas Florio wrote: > Hi everyone, I am Lucas and I am starting to use cucumber in project. > > I need to write a scenario that is little bit complex. > > Lets suppose I have a Thing and then I need to advance that Thing through 4 > stages (something like 'import'

[rspec-users] Best way of writing fetaures for a wizard

2009-02-11 Thread Lucas Florio
Hi everyone, I am Lucas and I am starting to use cucumber in project. I need to write a scenario that is little bit complex. Lets suppose I have a Thing and then I need to advance that Thing through 4 stages (something like 'import', 'validation', 'authorization', 'export'). Every stage is a spe

Re: [rspec-users] [cucumber] [alpha] The Backgrounder is run without cleaning up

2009-02-11 Thread aslak hellesoy
On Wed, Feb 11, 2009 at 2:10 AM, Chris Flipse wrote: > This /could/ just a screwy behavior I'm seeing in SQL lite, but I don't > think so; normal scenarios are doing this just fine. > > I'm playing with the Background feature in the .1.99 beta, and it looks like > it's being run before every featu