[rspec-users] Rspec not testing my callback

2010-11-15 Thread Andrew Davis
Hello everyone, I have a "before_save" at the top of my model, and it is being used correctly. However, when testing with RSpec/Rcov, my callback method is not being tested. Is there something specific I need to be doing? Thank you, Andrew Davis NASA - KSC -- Posted via http://www.ruby-forum.c

Re: [rspec-users] Rspec not testing my callback

2010-11-15 Thread David Chelimsky
On Mon, Nov 15, 2010 at 8:05 AM, Andrew Davis wrote: > Hello everyone, > > I have a "before_save" at the top of my model, and it is being used > correctly. However, when testing with RSpec/Rcov, my callback method is > not being tested. Is there something specific I need to be doing? Can't tell w

Re: [rspec-users] debugging calls with message expectations

2010-11-15 Thread David Chelimsky
On Sun, Nov 14, 2010 at 11:55 PM, Toni Tuominen wrote: > I'd like to know how to debug callers with message expectations. I > have a message expectation that should be called only once but for > some reason is called 13 times and I'd like to know where it's called > from. I've made the expectation

Re: [rspec-users] Rspec not testing my callback

2010-11-15 Thread Andrew Davis
Okay, I didn't think you needed to see any code since it seems general. And I meant "after_save" not "before_save". I guess it's kind of complicated since I have a lot of associations, but hopefully this will help you. My model class TaskOrder < ActiveRecord::Base after_update :save_product_gro

Re: [rspec-users] Rspec not testing my callback

2010-11-15 Thread David Chelimsky
On Nov 15, 2010, at 9:03 AM, Andrew Davis wrote: > Okay, I didn't think you needed to see any code since it seems general. Even if it's hypothetical, it's always better to post code so we have context for a conversation. The general answer to "RSpec is not testing my filters" is "you're doing

Re: [rspec-users] Rspec not testing my callback

2010-11-15 Thread Andrew Davis
Worked like a charm. Thanks again Mr. Chelimsky -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Rspec not testing my callback

2010-11-15 Thread Andrew Davis
Thank you David for your prompt response. I completely understand what you're getting at regarding the posting of code as well. I think you may have solved my problem, I'll give it a go later today. I appreciate it! Thanks, Andrew Davis NASA - KSC -- Posted via http://www.ruby-forum.com/. __

[rspec-users] RSpec not testing ".sum"

2010-11-15 Thread Andrew Davis
Hello all, I'm on the final stretch of testing my model, and I've realized that one simple line isn't being tested. I was hoping to get some insight on what I can do to accomplish this. The line that isn't being covered by Rcov is the ".sum". See code here: Test: http://pastie.org/private/djdqtma

Re: [rspec-users] RSpec not testing ".sum"

2010-11-15 Thread David Chelimsky
On Nov 15, 2010, at 2:13 PM, Andrew Davis wrote: > Hello all, > > I'm on the final stretch of testing my model, and I've realized that one > simple line isn't being tested. I was hoping to get some insight on what > I can do to accomplish this. The line that isn't being covered by Rcov > is the "

Re: [rspec-users] RSpec not testing ".sum"

2010-11-15 Thread Andrew Davis
Scratch this. It has been noted that rcov has a hard time distinguishing what the last line is. If I put all of the code in that model on one line, it works great. Thanks! Andrew Davis -- Posted via http://www.ruby-forum.com/. ___ rspec-users maili

[rspec-users] Problem testing Authlogic UserSession

2010-11-15 Thread Martin Hawkins
I've posted this to the Authlogic group but things seem a little quiet, so perhaps someone here can help: 'm testing Authlogic 2.1.6, running under Rails 3.0.1., using rspec 2.1.0 I have the following: user.rb class User < ActiveRecord::Base acts_as_authentic do |config| config.login_field

[rspec-users] Trouble making rspec-rails 2 work with webrat.

2010-11-15 Thread Peter Havens
I'm having problems getting rspec-rails 2 request specs to work with webrat. Any help would be appreciated. Here's my setup: ruby 1.9.2p0 rails 3.0.1 rspec-rails 2.1.0 webrat 0.7.2 Here's the error I'm getting: $ rspec --backtrace spec/requests/ssl_certificate_requests_spec.rb F Failures: 1)

Re: [rspec-users] Trouble making rspec-rails 2 work with webrat.

2010-11-15 Thread David Chelimsky
On Nov 15, 2010, at 4:51 PM, Peter Havens wrote: > I'm having problems getting rspec-rails 2 request specs to work with > webrat. Any help would be appreciated. Here's my setup: > > ruby 1.9.2p0 > rails 3.0.1 > rspec-rails 2.1.0 > webrat 0.7.2 > > Here's the error I'm getting: > > $ rspec --bac

[rspec-users] experimenting with stub in irb with RSpec2

2010-11-15 Thread Sarah Allen
In class, to give people a feel for how stubs work, I used to do this with rspec 1.x: sarah:~$ gem list rspec *** LOCAL GEMS *** rspec (1.3.0) rspec-rails (1.3.2) sarah:~$ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] sarah:~$ irb >> require 'spec' => true >> require 'spe

[rspec-users] why should_receive behaves differently

2010-11-15 Thread Sai Babu
Hi friends in my rspec_controller 1...@user.articles.should_receive(:find_by_id).with('1').and_return(@article) get :show,:id => 1 in above example 1 if i mention get :show, :id => 1 below the schould_receive it is working fine but 2]get :show,:id => 1 @user.articles.should_receive(:find_by_i

Re: [rspec-users] experimenting with stub in irb with RSpec2

2010-11-15 Thread David Chelimsky
On Nov 15, 2010, at 6:43 PM, Sarah Allen wrote: > In class, to give people a feel for how stubs work, I used to do this > with rspec 1.x: > > sarah:~$ gem list rspec > > *** LOCAL GEMS *** > > rspec (1.3.0) > rspec-rails (1.3.2) > sarah:~$ ruby -v > ruby 1.8.7 (2009-06-12 patchlevel 174) [univ

Re: [rspec-users] why should_receive behaves differently

2010-11-15 Thread David Chelimsky
On Nov 15, 2010, at 10:31 PM, Sai Babu wrote: > Hi friends > > in my rspec_controller > > 1...@user.articles.should_receive(:find_by_id).with('1').and_return(@article) > > get :show,:id => 1 > > in above example 1 if i mention get :show, :id => 1 below the > schould_receive > it is working fin