Hi David, I’m giving a try to RSpec after we meet each other on Rails
Summit Latin America and I must admit I’m enjoying using
rspec/machinist/faker.
Since I have not written any controllers yet, I hadn’t taken a chance to
try webrat.
But there is a situation that I would like some feedback on how to deal
with it.
When registering new users, they will input their e-mail and a message
will be sent for them to confirm their addresses and continue
registering.
I use something like:
MailNotifier.deliver_email_confirmation_message :confirmation_url =>
url_for(:controllers => ‘users’, :action => ‘continue_register’, :user
=> @user.id, :token => @user.confirmation_token)
And the routes are set to ‘:controller/:action’, so that the url would
translate to
‘/users/continue_register?user=2&confirmation_token=asdf987asf’.
The problem is that Ruby 1.8 will not maintain any specific order for
the parameters. (The application is hosted in a shared server at
hostingrails.com, which hosts Ruby 1.8)
I know that I could add a route to generate
‘/users/continue_register/2/asdf987asf’ instead, but I would still like
to know what would be the alternatives.
How could I verify that the delivered message contains a correct url? I
know that I should follow the url in an acceptance test, but I’m just
trying to test that the message is been correct generated, in a unit
test.
Please, let me know if I missed something conceptually while testing
this situation.
Thanks for RSpec and the tips about machinist, faker and webrat.
Just one more doubt. When using machinist, is it possible to ignore the
blueprint while calling ‘make’ on an ActiveRecord class? I had to create
a named blueprint reseting all fields set by the blueprint.
It was nice to meet you.
Best Regards,
Rodrigo.