[Rails] Re: how does the controller "know" about the model?
Carl Jenkins wrote:
> Thanks for the responses!
>
> So to me it seems like Ruby/Rails controllers know about the model;
> since Rails "stitches" the view, controllers and model together for you
> I guess that makes sense.
>
> A similar thing that is throwing me for a loop is something like this.
>
> test "should get index" do
> get :index
> assert_response :success
> assert_select '#columns #side a' , :minimum => 4
> assert_select '#main .entry' , 3
> assert_select 'h3' , 'Programming Ruby 1.9'
> assert_select '.price' , /\$[,\d]+\.\d\d/
> end
>
> This is a unit test from the book. The assert_select(s) test the html
> response. But, this really confuses me because I see now response
> anywhere?
What would you expect to see that you're not seeing? Why is this
confusing you?
> How in the world do the assert statements know of the HTML that was
> generated?
Why not look at the Test::Unit source code to find out?
(BTW, I recommend switching from Test::Unit to RSpec as soon as
possible.)
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home