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
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
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
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
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 :
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
>
> 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
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
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
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:
>
> >>>
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
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
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
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
>
> 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
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
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
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
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
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
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"
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?
>
> 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
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
24 matches
Mail list logo