Re: [rspec-users] rspec controller action list

2008-04-08 Thread Phillip Koebbe
Phillip Koebbe wrote: > > Namatra, Sorry, I spelled your name wrong. Namrata Peace, Phillip -- 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 controller action list

2008-04-08 Thread Phillip Koebbe
I'm a complete rSpec newbie, so I might be stepping in somewhere that I don't belong, but... Namatra, you said earlier that you were stubbing during setup, and you shared the before_post method. In the spec, though, you are going a :get. I'm not familiar with testing controllers yet (just get

Re: [rspec-users] rspec controller action list

2008-03-03 Thread Namrata Tiwari
Followed your example! Still getting the following error - Spec::Mocks::MockExpectationError in 'ArticlesController should list all article s' Mock 'ArticlesController' expected :find_city with (any args) once, but received it 0 times spec/controllers/articles_controller_spec.rb:3: Thanks, Namr

Re: [rspec-users] rspec controller action list

2008-03-03 Thread David Chelimsky
On Mon, Mar 3, 2008 at 11:21 PM, Namrata Tiwari <[EMAIL PROTECTED]> wrote: > Here is the action - > > def list > @articles = find_city.articles.paginate :all, :page => > params[:page] , :order => "live_on DESC", :conditions => { :type_for > => "blog" } > end > > and the spec - > > it

Re: [rspec-users] rspec controller action list

2008-03-03 Thread Namrata Tiwari
Here is the action - def list @articles = find_city.articles.paginate :all, :page => params[:page] , :order => "live_on DESC", :conditions => { :type_for => "blog" } end and the spec - it "should list all articles 2" do articles = mock("articles") get :list controller.shou

Re: [rspec-users] rspec controller action list

2008-03-03 Thread David Chelimsky
On Mon, Mar 3, 2008 at 5:22 AM, Namrata Tiwari <[EMAIL PROTECTED]> wrote: > > > > > If the code is the same as it was in the first post in this thread, > > it's because the action is taking place before setting the > > expectations. > > Yes, it is the same. As you have suggested earlier. > I

Re: [rspec-users] rspec controller action list

2008-03-03 Thread Namrata Tiwari
> > If the code is the same as it was in the first post in this thread, > it's because the action is taking place before setting the > expectations. Yes, it is the same. As you have suggested earlier. I am pasting the spec again. #list it "should list all articles" do articles = mock("art

Re: [rspec-users] rspec controller action list

2008-03-03 Thread David Chelimsky
On Mon, Mar 3, 2008 at 5:04 AM, Namrata Tiwari <[EMAIL PROTECTED]> wrote: > Matthias Hennemeyer wrote: > > Am 03.03.2008 um 04:38 schrieb Namrata Tiwari: > > > >> The method find_city is in application controller. I think the method > >> 'find_city' is being called but its expecting some args.

Re: [rspec-users] rspec controller action list

2008-03-03 Thread Namrata Tiwari
Matthias Hennemeyer wrote: > Am 03.03.2008 um 04:38 schrieb Namrata Tiwari: > >> The method find_city is in application controller. I think the method >> 'find_city' is being called but its expecting some args. >> > The message: > > Mock 'ArticlesController' expected :find_city with (any args) on

Re: [rspec-users] rspec controller action list

2008-03-03 Thread Matthias Hennemeyer
Am 03.03.2008 um 04:38 schrieb Namrata Tiwari: > The method find_city is in application controller. I think the method > 'find_city' is being called but its expecting some args. > The message: Mock 'ArticlesController' expected :find_city with (any args) once, but received it 0 times means th

Re: [rspec-users] rspec controller action list

2008-03-02 Thread Namrata Tiwari
Bryan Ray wrote: > It has to do with your "find_city" method. You spec is expecting it to > be > called from controller, hence: > > controller.should_receive(:find_city) > > Where is that method and why isn't it being called should be your next > questions based on the code and spec you've paste

Re: [rspec-users] rspec controller action list

2008-02-29 Thread Bryan Ray
It has to do with your "find_city" method. You spec is expecting it to be called from controller, hence: controller.should_receive(:find_city) Where is that method and why isn't it being called should be your next questions based on the code and spec you've pasted. Hope that helps, buddy. On Th

Re: [rspec-users] rspec controller action list

2008-02-28 Thread Namrata Tiwari
Thanks Mr David for your reply. This gives me a better understanding of so called train wreck. I am still facing problems with this spec. firstly - I think I need to put a colon before order(e.g. :order=> "live_on DESC") #list it "should list all articles" do articles = mock("articles")

Re: [rspec-users] rspec controller action list

2008-02-28 Thread David Chelimsky
On Thu, Feb 28, 2008 at 3:54 AM, Namrata Tiwari <[EMAIL PROTECTED]> wrote: > This action will list all the articles according to city. Please, can > some one guide me through this spec. > > def list > @articles = find_city.articles.paginate :all, :page => params[:page] This line has what we c

[rspec-users] rspec controller action list

2008-02-28 Thread Namrata Tiwari
This action will list all the articles according to city. Please, can some one guide me through this spec. def list @articles = find_city.articles.paginate :all, :page => params[:page] , :order => "live_on DESC", :conditions => { :type_for => "blog" } end it "should list all articles" do