Re: [rspec-users] before(:all) leaves records in database

2012-04-07 Thread nathanvda
When using before(:all) to create records in the database, you should use after(:all) to clean that up. Sometimes when you need to setup a lot of data, this can speed your tests a lot. Otherwise avoid it. On Friday, November 25, 2011 3:04:08 PM UTC+1, Zhi-Qiang Lei wrote: > > Hi, > > When I te

Re: [rspec-users] Attempting to speed up my controller specs: using before all fails?

2011-10-12 Thread nathanvda
Nobody? On Oct 11, 1:05 pm, nathanvda wrote: > I have a simple controller test, containing a.o. the following code: > >     context "POST :create" do >       before (:each) do >         post :create, :user_id => @user.id, >              :account => { .. some

[rspec-users] Attempting to speed up my controller specs: using before all fails?

2011-10-11 Thread nathanvda
I have a simple controller test, containing a.o. the following code: context "POST :create" do before (:each) do post :create, :user_id => @user.id, :account => { .. some data ... } end it { response.status.should == 201 } it { response.location.sho

Re: [rspec-users] testing a render of a partial in a helper

2011-10-11 Thread nathanvda
Ignore this, I had a different problem in my code causing this. On Oct 5, 9:28 pm, nathanvda wrote: > I am trying to spec my helpers, and I find a few of my helpers > actually render a partial. > > My code: > >     module PageHelper >       def settings_menu >         ren

[rspec-users] testing a render of a partial in a helper

2011-10-05 Thread nathanvda
I am trying to spec my helpers, and I find a few of my helpers actually render a partial. My code: module PageHelper def settings_menu render :partial => '_shared/settings_menu' end def banner_for(model) banner_message = ... some message ... render :

Re: [rspec-users] getting weird "no route matches" error, using rspec2 and rails3 (just migrated) but app works

2011-04-08 Thread nathanvda
I found it! It took my a while, eventually i diffed the log-files that see what happens differently. Apparently I have on spec file, where we try to test a baseclass. Inside that spec we define a new controller that derives from that baseclass, with a dummy index method. And also we need the rout

Re: [rspec-users] getting weird "no route matches" error, using rspec2 and rails3 (just migrated) but app works

2011-04-08 Thread nathanvda
> > in my main view i have a link to the root_path, which converts to > >     {:controller => "home", :action => :index} > > In every spec i run, i get the error: > >     No route matches {:controller=>"home"} > > While if i run the application in development, everything renders > without any probl

Re: [rspec-users] getting weird "no route matches" error, using rspec2 and rails3 (just migrated) but app works

2011-04-08 Thread nathanvda
More information: If i run rspec spec/**/*_spec.rb I suddenly get the same errors as when using `rake spec`. So??? rspec spec/controllers/user_controller/*_spec.rb gives all green, and with the first command those same specs fail ___ rsp

[rspec-users] getting weird "no route matches" error, using rspec2 and rails3 (just migrated) but app works

2011-04-07 Thread nathanvda
Hi there, in my main view i have a link to the root_path, which converts to {:controller => "home", :action => :index} In every spec i run, i get the error: No route matches {:controller=>"home"} While if i run the application in development, everything renders without any problem and

Re: [rspec-users] using rcov with rspec2

2010-10-06 Thread nathanvda
On 5 okt, 15:17, David Chelimsky wrote: > On Tue, Oct 5, 2010 at 7:28 AM, David Chelimsky wrote: > > On Tue, Oct 5, 2010 at 6:20 AM, nathanvda wrote: > >> On Oct 4, 3:24 am, Will Marshall wrote: > >>> > The error i get is this: > > >>>

Re: [rspec-users] using rcov with rspec2

2010-10-05 Thread nathanvda
I hoped the new rspec2.0.0.rc would fix it, but it doesn't. I hope anybody can shed any light on this? On Oct 4, 3:24 am, Will Marshall wrote: > > The error i get is this: > > > `require': no such file to load -- spec_helper (LoadError) > > The only solution I have found for this is to revert fr

[rspec-users] using rcov with rspec2

2010-09-20 Thread nathanvda
I have using rcov together with rspec2 using the following rake task: desc "Run all specs with rcov" RSpec::Core::RakeTask.new("test_cov") do |t| t.rcov = true t.rcov_opts = %w{--rails --include views --exclude gems\/,spec \/,features\/,seeds\/} end but since the latest beta, this

Re: [rspec-users] rails3: in production i get uninitialised constant rspec?

2010-09-13 Thread nathanvda
clean way to disable this task in production environment. Any hints? On Sep 13, 9:49 am, nathanvda wrote: > I am trying to deploy my rails3 application in a production > environment. But when i run my first rake task: > >     RAILS_ENV=production rake db:setup > > i always

[rspec-users] rails3: in production i get uninitialised constant rspec?

2010-09-13 Thread nathanvda
I am trying to deploy my rails3 application in a production environment. But when i run my first rake task: RAILS_ENV=production rake db:setup i always get the following result: rake aborted! uninitialized constant RSpec and then points to the line in the Rakefile where it says

Re: [rspec-users] rails3/rspec2: how to write mailer tests?

2010-09-02 Thread nathanvda
> > Start with "script/rails generate rspec:mailer sms" - that will generate a > stub for you and you can go from there. I am sorry if that was not clear, but i am using rspec2 and rails. I did use "rails g mailer SomethingMailer" and that produced an empty test. But when i did "rails g mailer S

[rspec-users] rails3/rspec2: how to write mailer tests?

2010-09-02 Thread nathanvda
This will sound awfully stupid, but i have no idea how to start writing any mailer tests. I have a mailer class class SmsMailer < ActionMailer::Base def fake_sms(envelope) mail(:to => envelope.user.email) end end how do I test this? I tried googling for documentation

Re: [rspec-users] rspec2: autotest keeps rerunning failing tests

2010-09-01 Thread nathanvda
I spoke too soon. Adding "autotest-rails" did not solve my problems either. Trying "bundle exec autotest" also did not help. I have been trying to use watchr, which seems faster, but when i save multiple files at once, only one file is tested again. But maybe i have to write a better wachtr script

Re: [rspec-users] rspec2: autotest keeps rerunning failing tests

2010-08-30 Thread nathanvda
nstalled on my system. So can't explain why, but now it works. There, i fixed it :) On Aug 30, 9:59 am, nathanvda wrote: > Since my update to beta.20 i have this weird thing. > Normally i develop with autotest on, and when i get an error: i can > check the errors, and they are rer

[rspec-users] rspec2: autotest keeps rerunning failing tests

2010-08-30 Thread nathanvda
Since my update to beta.20 i have this weird thing. Normally i develop with autotest on, and when i get an error: i can check the errors, and they are rerun when i save the files. If all my tests pass this is still the current behaviour, but if i have failing tests, autotest will keep running thos

Re: [rspec-users] upgrading rails 3.0.0.rc.2 and rspec 2.0.0.beta.20 breaks my view tests

2010-08-24 Thread nathanvda
Great David, thank you for your help! I did look at the docs but did not find that straighaway. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] upgrading rails 3.0.0.rc.2 and rspec 2.0.0.beta.20 breaks my view tests

2010-08-24 Thread nathanvda
I rolled back to version 2.0.0.beta.19 and everything is fine again. On Aug 24, 9:56 am, nathanvda wrote: > I was using rails 3 rc and rspec beta 19, and everything worked fine. > Today i updated and i get errors on the following methods: > > rendered.should contain("bla"

[rspec-users] upgrading rails 3.0.0.rc.2 and rspec 2.0.0.beta.20 breaks my view tests

2010-08-24 Thread nathanvda
I was using rails 3 rc and rspec beta 19, and everything worked fine. Today i updated and i get errors on the following methods: rendered.should contain("bla") rendered.should have_xpath(//table//tr) rendered.should have_selector('#foo') What should i do?

Re: [rspec-users] beginner questions: parametrize tests and disable tests (skippy?)

2010-07-27 Thread nathanvda
> > The way to do the "Skippy" thing under RSpec 2 will be filtering: > > http://blog.davidchelimsky.net/2010/06/14/filtering-examples-in-rspec-2/ Awesome! Just what i need :) > > Generally, the trade off between "explicit" and "DRY" is different in specs > than it is in code. In specs we value

[rspec-users] beginner questions: parametrize tests and disable tests (skippy?)

2010-07-26 Thread nathanvda
Hi there, i have two very specific questions. I am writing an application to send sms-es. Now i would like to be able, somehow, to disable the part of my tests that actually sends the sms-es. My code is tested, but to actually test sending the sms-es, i need to test the configuration. So it is nee