Re: [rspec-users] Can Rspec do module spec? What if module uses test data?

2007-08-22 Thread aslak hellesoy
Here is an example from RSpec's own specs: describe Enumerable do def each(&block) ["4", "2", "1"].each(&block) end it "should be included in examples because it is a module" do map{|e| e.to_i}.should == [4,2,1] end end If you pass the module to de

[rspec-users] How to spec an attachment_fu model

2007-08-22 Thread Matt Lins
First off, I'm not trying to spec attachment_fu, I know it's been tested. But, I added some code to that model that I do need to test. Basically, I need to somehow fulfill the "uploaded_data" property so I can actually run my tests(otherwise they fail because of validations). The "uploaded_dat

Re: [rspec-users] How to spec an attachment_fu model

2007-08-22 Thread aslak hellesoy
On 8/22/07, Matt Lins <[EMAIL PROTECTED]> wrote: > > First off, I'm not trying to spec attachment_fu, I know it's been tested. > > But, I added some code to that model that I do need to test. Basically, I > need to somehow fulfill the "uploaded_data" property so I can actually run > my tests(othe

Re: [rspec-users] How to spec an attachment_fu model

2007-08-22 Thread Matt Lins
Sorry, attachment_fu is a plugin for handling binary data. It handles storing the file in the file system and storing some helpful data in the database about the file. The previous code is from the attachment_fu plugin(no, I didn't modify it). This property needs to be satisfied in order for

Re: [rspec-users] How to spec an attachment_fu model

2007-08-22 Thread Justin W. Reagor
I just got finished working with attachment_fu, and ended up modeling a plugin for my company since attachment_fu was slight over kill for our needs. Have you opened up attachment_fu's source? upload_data is just a method (so is upload_data=) which is inserted into a model that calls has

Re: [rspec-users] How to spec an attachment_fu model

2007-08-22 Thread aslak hellesoy
On 8/22/07, Matt Lins <[EMAIL PROTECTED]> wrote: > > Sorry, attachment_fu is a plugin for handling binary data. It handles > storing the file in the file system and storing some helpful data in the > database about the file. > > The previous code is from the attachment_fu plugin(no, I didn't mod

[rspec-users] stubbing network calls

2007-08-22 Thread David Green
I have a couple of methods which make networks calls. Where's the best place to stub them so they are stubbed for every description automatically? I tried in spec_helper.rb but they are no longer stubbed when a spec runs. at the moment, I'm checking for the test environment in the methods themse

Re: [rspec-users] How to spec an attachment_fu model

2007-08-22 Thread Justin W. Reagor
# TODO: Allow it to work with Merb tempfiles too. def uploaded_data=(file_data) return nil if file_data.nil? || file_data.size == 0 self.content_type = file_data.content_type Durh... stupid me, didn't see this post! :) :: Justin Reagor :: [EMAIL PROTECTED] :: Justin

Re: [rspec-users] stubbing network calls

2007-08-22 Thread aslak hellesoy
On 8/22/07, David Green <[EMAIL PROTECTED]> wrote: > > I have a couple of methods which make networks calls. Where's the best place > to stub them so they are stubbed for every description automatically? I > tried in spec_helper.rb but they are no longer stubbed when a spec runs. > > at the moment,

Re: [rspec-users] How to spec an attachment_fu model

2007-08-22 Thread Matt Lins
No, as mentioned in my first post, the property that needs to be fulfilled is uploaded_data. I posted the accessor in my first post as well. aslak hellesoy wrote: On 8/22/07, Matt Lins <[EMAIL PROTECTED]> wrote: Sorry, attachment_fu is a plugin for handling binary data. It handles storing

Re: [rspec-users] How to spec an attachment_fu model

2007-08-22 Thread aslak hellesoy
On 8/22/07, Matt Lins <[EMAIL PROTECTED]> wrote: > > No, as mentioned in my first post, the property that needs to be fulfilled > is uploaded_data. I posted the accessor in my first post as well. > Which part of my answer are you answering no to? Can you inline your answers so I can follow? > >

Re: [rspec-users] stubbing network calls

2007-08-22 Thread David Green
On 8/22/07, David Green <[EMAIL PROTECTED]> wrote: > > I have a couple of methods which make networks calls. Where's the best > place > to stub them so they are stubbed for every description automatically? I > tried in spec_helper.rb but they are no longer stubbed when a spec runs. > > at the mom

Re: [rspec-users] How to spec an attachment_fu model

2007-08-22 Thread Jerry West
I think you need to clarify what you mean by 'spec an attachment_fu model'. Do you want the validates_as_attachment to succeed with your test data, for instance? If so, simply stub the call: Picture.should_receive(:validates_as_attachment) so that you can be confident the model does the right

[rspec-users] Can module spec use fixtures?

2007-08-22 Thread Shaker
Good morning, dear fellows: I'd like to recall one question I posted yesterday. I am writing specs for ruby modules. Some of the modules do some data process in the test database. Because 'fixtures' is undefined (Am I correct?) in module specs, spec of certain module (e.g. delete data form dat

Re: [rspec-users] Can module spec use fixtures?

2007-08-22 Thread Luis Lavena
On 8/22/07, Shaker <[EMAIL PROTECTED]> wrote: > > Good morning, dear fellows: > I'd like to recall one question I posted yesterday. I am writing specs > for ruby modules. Some of the modules do some data process in the test > database. Because 'fixtures' is undefined (Am I correct?) in module s