Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-12 Thread Jay Levitt
David Chelimsky wrote:
 On 8/10/07, Lance Carlson [EMAIL PROTECTED] wrote:
 Thanks for your patience trying to resolve this issue. I posted a bug
 report here:

 http://rubyforge.org/tracker/index.php?func=detailaid=12963group_id=797atid=3149
 
 I see it - thanks. If you have time now, Lance, pls join the #rspec IRC chat.

How did this chat go, if it went?  I'm about to dive into this problem 
but don't want to duplicate efforts.

Jay

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-12 Thread Lance Carlson
It was never resolved.. the only resolution was to mock out the
methods at this point or provide the views with the instance
variables.

On 8/12/07, Jay Levitt [EMAIL PROTECTED] wrote:
 David Chelimsky wrote:
  On 8/10/07, Lance Carlson [EMAIL PROTECTED] wrote:
  Thanks for your patience trying to resolve this issue. I posted a bug
  report here:
 
  http://rubyforge.org/tracker/index.php?func=detailaid=12963group_id=797atid=3149
 
  I see it - thanks. If you have time now, Lance, pls join the #rspec IRC 
  chat.

 How did this chat go, if it went?  I'm about to dive into this problem
 but don't want to duplicate efforts.

 Jay

 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-12 Thread Jay Levitt
Lance Carlson wrote:
 It was never resolved.. the only resolution was to mock out the
 methods at this point or provide the views with the instance
 variables.

Well, I didn't get anywhere tonight - but I did discover that 
script/console has the same problem.  Given routes.rb:

map.resources :users, :member =
 {:edit_business_card = :get,
  :update_business_card = :put }

and:

  app.update_business_card_user_url

I get:

ActionController::RoutingError: update_business_card_user_url failed to 
generate from {:controller=users, :action=update_business_card} - 
you may have ambiguous routes, or you may need to supply additional 
parameters for this route.  content_url has the following required 
parameters: [users, :id, update_business_card] - are they all satisfied?

Yet using update_business_card_user_url from a view works fine.

Since I can duplicate it without rspec, I'll post a message to 
rubyonrails-talk and see if anyone has some ideas.

Jay

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-10 Thread Lance Carlson
Thanks for your patience trying to resolve this issue. I posted a bug
report here:

http://rubyforge.org/tracker/index.php?func=detailaid=12963group_id=797atid=3149

On 8/10/07, David Chelimsky [EMAIL PROTECTED] wrote:
 On 8/9/07, Lance Carlson [EMAIL PROTECTED] wrote:
  About these methods requiring arguments? I thought you were able to
  reproduce the problems I was having and was also able to reproduce a
  working application with no arguments.

 That is correct.

  By default these methods should
  not require arguments to be passed as it is unnecessary noise in the
  code.

 I understand that, but that was news to me as of this thread. I spent
 a couple of hours banging my head against this and found the generated
 code I mentioned earlier in the thread. That's the only insight I have
 to offer at this point.

  Perhaps we can continue this discussion on IRC? #rspec?

 I'll pop in at one point this morning but I really don't have much in
 the way of cycles to spend on this right now. I'm happy to help point
 you in the right direction, but it's not very high on my priority
 list. In the mean time, now that we know this is a bug, would you
 kindly report it in the tracker?

 http://rubyforge.org/tracker/?atid=3149group_id=797func=browse

  What is your s/n?
 
  On 8/9/07, David Chelimsky [EMAIL PROTECTED] wrote:
   On 8/9/07, Lance Carlson [EMAIL PROTECTED] wrote:
Is it possible that rspec is not pulling the instance variables into
the method because this method is being defined before instance
variables in parameters are assigned to that method? I'm trying to
hone down where the problem is popping up exactly. Any insight?
  
   Not really more than what I said earlier in this thread.
  
On 8/9/07, David Chelimsky [EMAIL PROTECTED] wrote:
 On 8/9/07, Lance Carlson [EMAIL PROTECTED] wrote:
  Were you able to come up with any solutions?

 Nope. Anyone else?

 
  On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
   On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
Awesome! Thank you! :)
  
   Don't thank me yet. I've spent some time trying to track this 
   down and
   I've found my way into some methods in routing.rb that are 
   dynamically
   generated (and so you can't )(*)(* read them to debug them 
   quite so
   easily) that call the methods (in your case) label_id_value and
   id_value (being the artist id). I have no idea yet where those two
   methods get generated. Once I do, then we can stub them. 
   Unfortunately
   I can't really spend any more time on this right now (though I'd 
   love
   to solve it).
  
   In the mean time, you'll just have to use the parameters if you 
   want
   the specs to work with the same code with which your app works.
  
  
   
On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
 On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
  I just visited the action in my browser and i don't get any 
  errors. I
  am also running on edge rails as the application relies on
  ActiveResource. Can you show me the code you created?

 OK - I've created a small project and am able to reproduce the
 behaviour you're describing. I'll follow up when learn 
 something.

 David
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
   
   ___
   rspec-users mailing list
   rspec-users@rubyforge.org
   http://rubyforge.org/mailman/listinfo/rspec-users
  
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
   
   ___
   rspec-users mailing list
   rspec-users@rubyforge.org
   http://rubyforge.org/mailman/listinfo/rspec-users
  
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-10 Thread David Chelimsky
On 8/9/07, Lance Carlson [EMAIL PROTECTED] wrote:
 About these methods requiring arguments? I thought you were able to
 reproduce the problems I was having and was also able to reproduce a
 working application with no arguments.

That is correct.

 By default these methods should
 not require arguments to be passed as it is unnecessary noise in the
 code.

I understand that, but that was news to me as of this thread. I spent
a couple of hours banging my head against this and found the generated
code I mentioned earlier in the thread. That's the only insight I have
to offer at this point.

 Perhaps we can continue this discussion on IRC? #rspec?

I'll pop in at one point this morning but I really don't have much in
the way of cycles to spend on this right now. I'm happy to help point
you in the right direction, but it's not very high on my priority
list. In the mean time, now that we know this is a bug, would you
kindly report it in the tracker?

http://rubyforge.org/tracker/?atid=3149group_id=797func=browse

 What is your s/n?

 On 8/9/07, David Chelimsky [EMAIL PROTECTED] wrote:
  On 8/9/07, Lance Carlson [EMAIL PROTECTED] wrote:
   Is it possible that rspec is not pulling the instance variables into
   the method because this method is being defined before instance
   variables in parameters are assigned to that method? I'm trying to
   hone down where the problem is popping up exactly. Any insight?
 
  Not really more than what I said earlier in this thread.
 
   On 8/9/07, David Chelimsky [EMAIL PROTECTED] wrote:
On 8/9/07, Lance Carlson [EMAIL PROTECTED] wrote:
 Were you able to come up with any solutions?
   
Nope. Anyone else?
   

 On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
  On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
   Awesome! Thank you! :)
 
  Don't thank me yet. I've spent some time trying to track this down 
  and
  I've found my way into some methods in routing.rb that are 
  dynamically
  generated (and so you can't )(*)(* read them to debug them quite 
  so
  easily) that call the methods (in your case) label_id_value and
  id_value (being the artist id). I have no idea yet where those two
  methods get generated. Once I do, then we can stub them. 
  Unfortunately
  I can't really spend any more time on this right now (though I'd 
  love
  to solve it).
 
  In the mean time, you'll just have to use the parameters if you want
  the specs to work with the same code with which your app works.
 
 
  
   On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
 I just visited the action in my browser and i don't get any 
 errors. I
 am also running on edge rails as the application relies on
 ActiveResource. Can you show me the code you created?
   
OK - I've created a small project and am able to reproduce the
behaviour you're describing. I'll follow up when learn 
something.
   
David
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
   
   ___
   rspec-users mailing list
   rspec-users@rubyforge.org
   http://rubyforge.org/mailman/listinfo/rspec-users
  
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
   
   ___
   rspec-users mailing list
   rspec-users@rubyforge.org
   http://rubyforge.org/mailman/listinfo/rspec-users
  
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-09 Thread Lance Carlson
About these methods requiring arguments? I thought you were able to
reproduce the problems I was having and was also able to reproduce a
working application with no arguments. By default these methods should
not require arguments to be passed as it is unnecessary noise in the
code. Perhaps we can continue this discussion on IRC? #rspec? What is
your s/n?

On 8/9/07, David Chelimsky [EMAIL PROTECTED] wrote:
 On 8/9/07, Lance Carlson [EMAIL PROTECTED] wrote:
  Is it possible that rspec is not pulling the instance variables into
  the method because this method is being defined before instance
  variables in parameters are assigned to that method? I'm trying to
  hone down where the problem is popping up exactly. Any insight?

 Not really more than what I said earlier in this thread.

  On 8/9/07, David Chelimsky [EMAIL PROTECTED] wrote:
   On 8/9/07, Lance Carlson [EMAIL PROTECTED] wrote:
Were you able to come up with any solutions?
  
   Nope. Anyone else?
  
   
On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
 On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
  Awesome! Thank you! :)

 Don't thank me yet. I've spent some time trying to track this down and
 I've found my way into some methods in routing.rb that are dynamically
 generated (and so you can't )(*)(* read them to debug them quite so
 easily) that call the methods (in your case) label_id_value and
 id_value (being the artist id). I have no idea yet where those two
 methods get generated. Once I do, then we can stub them. Unfortunately
 I can't really spend any more time on this right now (though I'd love
 to solve it).

 In the mean time, you'll just have to use the parameters if you want
 the specs to work with the same code with which your app works.


 
  On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
   On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
I just visited the action in my browser and i don't get any 
errors. I
am also running on edge rails as the application relies on
ActiveResource. Can you show me the code you created?
  
   OK - I've created a small project and am able to reproduce the
   behaviour you're describing. I'll follow up when learn something.
  
   David
   ___
   rspec-users mailing list
   rspec-users@rubyforge.org
   http://rubyforge.org/mailman/listinfo/rspec-users
  
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
   
   ___
   rspec-users mailing list
   rspec-users@rubyforge.org
   http://rubyforge.org/mailman/listinfo/rspec-users
  
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-09 Thread David Chelimsky
On 8/9/07, Lance Carlson [EMAIL PROTECTED] wrote:
 Is it possible that rspec is not pulling the instance variables into
 the method because this method is being defined before instance
 variables in parameters are assigned to that method? I'm trying to
 hone down where the problem is popping up exactly. Any insight?

Not really more than what I said earlier in this thread.

 On 8/9/07, David Chelimsky [EMAIL PROTECTED] wrote:
  On 8/9/07, Lance Carlson [EMAIL PROTECTED] wrote:
   Were you able to come up with any solutions?
 
  Nope. Anyone else?
 
  
   On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
 Awesome! Thank you! :)
   
Don't thank me yet. I've spent some time trying to track this down and
I've found my way into some methods in routing.rb that are dynamically
generated (and so you can't )(*)(* read them to debug them quite so
easily) that call the methods (in your case) label_id_value and
id_value (being the artist id). I have no idea yet where those two
methods get generated. Once I do, then we can stub them. Unfortunately
I can't really spend any more time on this right now (though I'd love
to solve it).
   
In the mean time, you'll just have to use the parameters if you want
the specs to work with the same code with which your app works.
   
   

 On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
  On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
   I just visited the action in my browser and i don't get any 
   errors. I
   am also running on edge rails as the application relies on
   ActiveResource. Can you show me the code you created?
 
  OK - I've created a small project and am able to reproduce the
  behaviour you're describing. I'll follow up when learn something.
 
  David
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
   
   ___
   rspec-users mailing list
   rspec-users@rubyforge.org
   http://rubyforge.org/mailman/listinfo/rspec-users
  
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


[rspec-users] Problems with RESTfully generated helpers

2007-08-08 Thread Lance Carlson
I am using helper the RESTfully generated helper methods in my views.
My routes are nested so the helpers appear to need arguments passed to
them, but it works without arguments. Say for example I have pages and
comments. If I do page_comments_path without parameters, it works.
However, when I run the rspec test, it fails and tells me i'm missing
parameters. I tried to pass params[:page_id], but it still says it
needs parameters. I did fill in the parameters like it asked and the
test passed, but I think my views look cleaner without the arguments
being passed everywhere. Do I have to stub these methods to get my
views to pass, or is there some other way?

TIA,
Lance
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-08 Thread David Chelimsky
On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
 I am using helper the RESTfully generated helper methods in my views.
 My routes are nested so the helpers appear to need arguments passed to
 them, but it works without arguments. Say for example I have pages and
 comments. If I do page_comments_path without parameters, it works.
 However, when I run the rspec test, it fails and tells me i'm missing
 parameters. I tried to pass params[:page_id], but it still says it
 needs parameters. I did fill in the parameters like it asked and the
 test passed, but I think my views look cleaner without the arguments
 being passed everywhere. Do I have to stub these methods to get my
 views to pass, or is there some other way?

It would be much easier to answer your question if you posted the
actual spec and code.


 TIA,
 Lance
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-08 Thread Lance Carlson
I just passed label_artist_path(@label.id, @artist.id) into the view
and it worked.. but I really don't want to have to pass those
parameters in all my views. It looks ugly. Does anyone know a way
around this without stubbing? It seems useless to test this view
without allowing those methods to act out their real behavior.

-TIA

On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
 ActionView::TemplateError in 'Edit Artist Page should render the edit
 artist form'
 label_artist_url failed to generate from {:controller=artists,
 :action=show} - you may have ambiguous routes, or you may need to
 supply additional parameters for this route.  content_url has the
 following required parameters: [labels, :label_id, artists, :id] -
 are they all satisfied?
 On line #3 of app/views/artists/edit.rhtml

 1: h1Editing artist/h1
 2:
 3: % form_tag label_artist_path, :method = :put do %
 4:   %= render :partial = 'form' %
 5:   %= submit_tag 'Save' %
 6: % end %


 My spec looks like:

 require File.dirname(__FILE__) + '/../../spec_helper'

 describe 'Edit Artist Page' do
   before do
 @label = mock_model(Label)
 @artist = mock_model(Artist)

 assigns[:label] = @label
 assigns[:artist] = @artist
   end

   def render_edit
 render :template = 'artists/edit'
   end

   it should render the edit artist form do
 render_edit
   end
 end

 On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
  On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
   I am using helper the RESTfully generated helper methods in my views.
   My routes are nested so the helpers appear to need arguments passed to
   them, but it works without arguments. Say for example I have pages and
   comments. If I do page_comments_path without parameters, it works.
   However, when I run the rspec test, it fails and tells me i'm missing
   parameters. I tried to pass params[:page_id], but it still says it
   needs parameters. I did fill in the parameters like it asked and the
   test passed, but I think my views look cleaner without the arguments
   being passed everywhere. Do I have to stub these methods to get my
   views to pass, or is there some other way?
 
  It would be much easier to answer your question if you posted the
  actual spec and code.
 
  
   TIA,
   Lance
   ___
   rspec-users mailing list
   rspec-users@rubyforge.org
   http://rubyforge.org/mailman/listinfo/rspec-users
  
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-08 Thread David Chelimsky
On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
 I just passed label_artist_path(@label.id, @artist.id) into the view
 and it worked.. but I really don't want to have to pass those
 parameters in all my views. It looks ugly. Does anyone know a way
 around this without stubbing? It seems useless to test this view
 without allowing those methods to act out their real behavior.

Can you point me to docs that say you're supposed to be able to just
call label_artist_path without any args? I've not see such docs and I
can't get it to work in any of my views - and I'm talking about just
rendering the views at all, not getting specs to work.


 -TIA

 On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
  ActionView::TemplateError in 'Edit Artist Page should render the edit
  artist form'
  label_artist_url failed to generate from {:controller=artists,
  :action=show} - you may have ambiguous routes, or you may need to
  supply additional parameters for this route.  content_url has the
  following required parameters: [labels, :label_id, artists, :id] -
  are they all satisfied?
  On line #3 of app/views/artists/edit.rhtml
 
  1: h1Editing artist/h1
  2:
  3: % form_tag label_artist_path, :method = :put do %
  4:   %= render :partial = 'form' %
  5:   %= submit_tag 'Save' %
  6: % end %
 
 
  My spec looks like:
 
  require File.dirname(__FILE__) + '/../../spec_helper'
 
  describe 'Edit Artist Page' do
before do
  @label = mock_model(Label)
  @artist = mock_model(Artist)
 
  assigns[:label] = @label
  assigns[:artist] = @artist
end
 
def render_edit
  render :template = 'artists/edit'
end
 
it should render the edit artist form do
  render_edit
end
  end
 
  On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
   On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
I am using helper the RESTfully generated helper methods in my views.
My routes are nested so the helpers appear to need arguments passed to
them, but it works without arguments. Say for example I have pages and
comments. If I do page_comments_path without parameters, it works.
However, when I run the rspec test, it fails and tells me i'm missing
parameters. I tried to pass params[:page_id], but it still says it
needs parameters. I did fill in the parameters like it asked and the
test passed, but I think my views look cleaner without the arguments
being passed everywhere. Do I have to stub these methods to get my
views to pass, or is there some other way?
  
   It would be much easier to answer your question if you posted the
   actual spec and code.
  
   
TIA,
Lance
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
   
   ___
   rspec-users mailing list
   rspec-users@rubyforge.org
   http://rubyforge.org/mailman/listinfo/rspec-users
  
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-08 Thread Lance Carlson
All I'm doing is passing the instance variables @label and @artist in
the controller to the view using this code:

@label = current_user.labels.find(params[:label_id])
@artist = params[:id].nil? ? Artist.new : @label.artists.find(params[:id])

By sending these two instance variables to the view, I don't need to
specify these arguments and the view just works. Can you get it to
work when you specify these instance variables in your controller?

-L

On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
 On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
  I just passed label_artist_path(@label.id, @artist.id) into the view
  and it worked.. but I really don't want to have to pass those
  parameters in all my views. It looks ugly. Does anyone know a way
  around this without stubbing? It seems useless to test this view
  without allowing those methods to act out their real behavior.

 Can you point me to docs that say you're supposed to be able to just
 call label_artist_path without any args? I've not see such docs and I
 can't get it to work in any of my views - and I'm talking about just
 rendering the views at all, not getting specs to work.

 
  -TIA
 
  On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
   ActionView::TemplateError in 'Edit Artist Page should render the edit
   artist form'
   label_artist_url failed to generate from {:controller=artists,
   :action=show} - you may have ambiguous routes, or you may need to
   supply additional parameters for this route.  content_url has the
   following required parameters: [labels, :label_id, artists, :id] -
   are they all satisfied?
   On line #3 of app/views/artists/edit.rhtml
  
   1: h1Editing artist/h1
   2:
   3: % form_tag label_artist_path, :method = :put do %
   4:   %= render :partial = 'form' %
   5:   %= submit_tag 'Save' %
   6: % end %
  
  
   My spec looks like:
  
   require File.dirname(__FILE__) + '/../../spec_helper'
  
   describe 'Edit Artist Page' do
 before do
   @label = mock_model(Label)
   @artist = mock_model(Artist)
  
   assigns[:label] = @label
   assigns[:artist] = @artist
 end
  
 def render_edit
   render :template = 'artists/edit'
 end
  
 it should render the edit artist form do
   render_edit
 end
   end
  
   On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
 I am using helper the RESTfully generated helper methods in my views.
 My routes are nested so the helpers appear to need arguments passed to
 them, but it works without arguments. Say for example I have pages and
 comments. If I do page_comments_path without parameters, it works.
 However, when I run the rspec test, it fails and tells me i'm missing
 parameters. I tried to pass params[:page_id], but it still says it
 needs parameters. I did fill in the parameters like it asked and the
 test passed, but I think my views look cleaner without the arguments
 being passed everywhere. Do I have to stub these methods to get my
 views to pass, or is there some other way?
   
It would be much easier to answer your question if you posted the
actual spec and code.
   

 TIA,
 Lance
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
   
  
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-08 Thread David Chelimsky
On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
 All I'm doing is passing the instance variables @label and @artist in
 the controller to the view using this code:

 @label = current_user.labels.find(params[:label_id])
 @artist = params[:id].nil? ? Artist.new : @label.artists.find(params[:id])

 By sending these two instance variables to the view, I don't need to
 specify these arguments and the view just works. Can you get it to
 work when you specify these instance variables in your controller?

No. That's what I'm saying. I get the same ambigous URL error you
cited in the first email in this thread, but in the browser. Using
edge rails, edge rspec.


 -L

 On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
  On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
   I just passed label_artist_path(@label.id, @artist.id) into the view
   and it worked.. but I really don't want to have to pass those
   parameters in all my views. It looks ugly. Does anyone know a way
   around this without stubbing? It seems useless to test this view
   without allowing those methods to act out their real behavior.
 
  Can you point me to docs that say you're supposed to be able to just
  call label_artist_path without any args? I've not see such docs and I
  can't get it to work in any of my views - and I'm talking about just
  rendering the views at all, not getting specs to work.
 
  
   -TIA
  
   On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
ActionView::TemplateError in 'Edit Artist Page should render the edit
artist form'
label_artist_url failed to generate from {:controller=artists,
:action=show} - you may have ambiguous routes, or you may need to
supply additional parameters for this route.  content_url has the
following required parameters: [labels, :label_id, artists, :id] -
are they all satisfied?
On line #3 of app/views/artists/edit.rhtml
   
1: h1Editing artist/h1
2:
3: % form_tag label_artist_path, :method = :put do %
4:   %= render :partial = 'form' %
5:   %= submit_tag 'Save' %
6: % end %
   
   
My spec looks like:
   
require File.dirname(__FILE__) + '/../../spec_helper'
   
describe 'Edit Artist Page' do
  before do
@label = mock_model(Label)
@artist = mock_model(Artist)
   
assigns[:label] = @label
assigns[:artist] = @artist
  end
   
  def render_edit
render :template = 'artists/edit'
  end
   
  it should render the edit artist form do
render_edit
  end
end
   
On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
 On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
  I am using helper the RESTfully generated helper methods in my 
  views.
  My routes are nested so the helpers appear to need arguments passed 
  to
  them, but it works without arguments. Say for example I have pages 
  and
  comments. If I do page_comments_path without parameters, it works.
  However, when I run the rspec test, it fails and tells me i'm 
  missing
  parameters. I tried to pass params[:page_id], but it still says it
  needs parameters. I did fill in the parameters like it asked and the
  test passed, but I think my views look cleaner without the arguments
  being passed everywhere. Do I have to stub these methods to get my
  views to pass, or is there some other way?

 It would be much easier to answer your question if you posted the
 actual spec and code.

 
  TIA,
  Lance
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

   
   ___
   rspec-users mailing list
   rspec-users@rubyforge.org
   http://rubyforge.org/mailman/listinfo/rspec-users
  
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-08 Thread Lance Carlson
I just visited the action in my browser and i don't get any errors. I
am also running on edge rails as the application relies on
ActiveResource. Can you show me the code you created?

On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
 On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
  All I'm doing is passing the instance variables @label and @artist in
  the controller to the view using this code:
 
  @label = current_user.labels.find(params[:label_id])
  @artist = params[:id].nil? ? Artist.new : @label.artists.find(params[:id])
 
  By sending these two instance variables to the view, I don't need to
  specify these arguments and the view just works. Can you get it to
  work when you specify these instance variables in your controller?

 No. That's what I'm saying. I get the same ambigous URL error you
 cited in the first email in this thread, but in the browser. Using
 edge rails, edge rspec.

 
  -L
 
  On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
   On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
I just passed label_artist_path(@label.id, @artist.id) into the view
and it worked.. but I really don't want to have to pass those
parameters in all my views. It looks ugly. Does anyone know a way
around this without stubbing? It seems useless to test this view
without allowing those methods to act out their real behavior.
  
   Can you point me to docs that say you're supposed to be able to just
   call label_artist_path without any args? I've not see such docs and I
   can't get it to work in any of my views - and I'm talking about just
   rendering the views at all, not getting specs to work.
  
   
-TIA
   
On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
 ActionView::TemplateError in 'Edit Artist Page should render the edit
 artist form'
 label_artist_url failed to generate from {:controller=artists,
 :action=show} - you may have ambiguous routes, or you may need to
 supply additional parameters for this route.  content_url has the
 following required parameters: [labels, :label_id, artists, :id] -
 are they all satisfied?
 On line #3 of app/views/artists/edit.rhtml

 1: h1Editing artist/h1
 2:
 3: % form_tag label_artist_path, :method = :put do %
 4:   %= render :partial = 'form' %
 5:   %= submit_tag 'Save' %
 6: % end %


 My spec looks like:

 require File.dirname(__FILE__) + '/../../spec_helper'

 describe 'Edit Artist Page' do
   before do
 @label = mock_model(Label)
 @artist = mock_model(Artist)

 assigns[:label] = @label
 assigns[:artist] = @artist
   end

   def render_edit
 render :template = 'artists/edit'
   end

   it should render the edit artist form do
 render_edit
   end
 end

 On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
  On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
   I am using helper the RESTfully generated helper methods in my 
   views.
   My routes are nested so the helpers appear to need arguments 
   passed to
   them, but it works without arguments. Say for example I have 
   pages and
   comments. If I do page_comments_path without parameters, it works.
   However, when I run the rspec test, it fails and tells me i'm 
   missing
   parameters. I tried to pass params[:page_id], but it still says it
   needs parameters. I did fill in the parameters like it asked and 
   the
   test passed, but I think my views look cleaner without the 
   arguments
   being passed everywhere. Do I have to stub these methods to get my
   views to pass, or is there some other way?
 
  It would be much easier to answer your question if you posted the
  actual spec and code.
 
  
   TIA,
   Lance
   ___
   rspec-users mailing list
   rspec-users@rubyforge.org
   http://rubyforge.org/mailman/listinfo/rspec-users
  
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
   
   ___
   rspec-users mailing list
   rspec-users@rubyforge.org
   http://rubyforge.org/mailman/listinfo/rspec-users
  
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___

Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-08 Thread Lance Carlson
Yes,

  map.resources :labels do |label|
label.resources :artists
  end

On 8/8/07, Jay Levitt [EMAIL PROTECTED] wrote:
 David Chelimsky wrote:
  On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
  All I'm doing is passing the instance variables @label and @artist in
  the controller to the view using this code:
 
  @label = current_user.labels.find(params[:label_id])
  @artist = params[:id].nil? ? Artist.new : @label.artists.find(params[:id])
 
  By sending these two instance variables to the view, I don't need to
  specify these arguments and the view just works. Can you get it to
  work when you specify these instance variables in your controller?
 
  No. That's what I'm saying. I get the same ambigous URL error you
  cited in the first email in this thread, but in the browser. Using
  edge rails, edge rspec.

 Dumb question, but do you have the resource mapped in your routes.rb
 file?  Something like

 map.resources :artists

 Jay

 
  -L
 
  On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
  On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
  I just passed label_artist_path(@label.id, @artist.id) into the view
  and it worked.. but I really don't want to have to pass those
  parameters in all my views. It looks ugly. Does anyone know a way
  around this without stubbing? It seems useless to test this view
  without allowing those methods to act out their real behavior.
  Can you point me to docs that say you're supposed to be able to just
  call label_artist_path without any args? I've not see such docs and I
  can't get it to work in any of my views - and I'm talking about just
  rendering the views at all, not getting specs to work.
 
  -TIA
 
  On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
  ActionView::TemplateError in 'Edit Artist Page should render the edit
  artist form'
  label_artist_url failed to generate from {:controller=artists,
  :action=show} - you may have ambiguous routes, or you may need to
  supply additional parameters for this route.  content_url has the
  following required parameters: [labels, :label_id, artists, :id] -
  are they all satisfied?
  On line #3 of app/views/artists/edit.rhtml
 
  1: h1Editing artist/h1
  2:
  3: % form_tag label_artist_path, :method = :put do %
  4:   %= render :partial = 'form' %
  5:   %= submit_tag 'Save' %
  6: % end %
 
 
  My spec looks like:
 
  require File.dirname(__FILE__) + '/../../spec_helper'
 
  describe 'Edit Artist Page' do
before do
  @label = mock_model(Label)
  @artist = mock_model(Artist)
 
  assigns[:label] = @label
  assigns[:artist] = @artist
end
 
def render_edit
  render :template = 'artists/edit'
end
 
it should render the edit artist form do
  render_edit
end
  end
 
  On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
  On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
  I am using helper the RESTfully generated helper methods in my views.
  My routes are nested so the helpers appear to need arguments passed to
  them, but it works without arguments. Say for example I have pages and
  comments. If I do page_comments_path without parameters, it works.
  However, when I run the rspec test, it fails and tells me i'm missing
  parameters. I tried to pass params[:page_id], but it still says it
  needs parameters. I did fill in the parameters like it asked and the
  test passed, but I think my views look cleaner without the arguments
  being passed everywhere. Do I have to stub these methods to get my
  views to pass, or is there some other way?
  It would be much easier to answer your question if you posted the
  actual spec and code.
 
  TIA,
  Lance
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users

 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-08 Thread Lance Carlson
Awesome! Thank you! :)

On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
 On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
  I just visited the action in my browser and i don't get any errors. I
  am also running on edge rails as the application relies on
  ActiveResource. Can you show me the code you created?

 OK - I've created a small project and am able to reproduce the
 behaviour you're describing. I'll follow up when learn something.

 David
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Problems with RESTfully generated helpers

2007-08-08 Thread David Chelimsky
On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
 Awesome! Thank you! :)

Don't thank me yet. I've spent some time trying to track this down and
I've found my way into some methods in routing.rb that are dynamically
generated (and so you can't )(*)(* read them to debug them quite so
easily) that call the methods (in your case) label_id_value and
id_value (being the artist id). I have no idea yet where those two
methods get generated. Once I do, then we can stub them. Unfortunately
I can't really spend any more time on this right now (though I'd love
to solve it).

In the mean time, you'll just have to use the parameters if you want
the specs to work with the same code with which your app works.



 On 8/8/07, David Chelimsky [EMAIL PROTECTED] wrote:
  On 8/8/07, Lance Carlson [EMAIL PROTECTED] wrote:
   I just visited the action in my browser and i don't get any errors. I
   am also running on edge rails as the application relies on
   ActiveResource. Can you show me the code you created?
 
  OK - I've created a small project and am able to reproduce the
  behaviour you're describing. I'll follow up when learn something.
 
  David
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users