On 7/27/07, Justin Williams <[EMAIL PROTECTED]> wrote:
> Thanks for the help.
>
You're welcome
> I think I'm getting closer. I'm still not getting a redirect. I
> still think it's the same reason though. I say this because when I
> modify the last line of my spec to be render_template("index")
Thanks for the help.
I think I'm getting closer. I'm still not getting a redirect. I
still think it's the same reason though. I say this because when I
modify the last line of my spec to be render_template("index") instead
of redirect, it says that it renders the login template.
Am I putting t
For starters, refactor your user<-->roles interaction.
class User
def has_role?(name)
role = Role.find_by_name(name)
roles.include?(role)
end
end
Trust me, this will make things much easier to spec, and later, to
scale. Also, it keeps the DB-specific stuff ("find") in the model,
wh
I've done some more work on the specs, and it seems that my mocks
aren't pushing in the roles array associated with current_user.
describe UsersController do
before(:each) do
@user = mock_model(User,
:id => 1,
:email => '[EMAIL PROTECTED]',
:password => 'teamup'
)
On 7/24/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
> Would you please post the code for the actions as well?
def login
if request.post?
begin
session[:user] = User.authenticate(params[:login][:email],
params[:login][:password]).id
if current_user.roles.include?(Role.find_by_title
On 7/24/07, Justin Williams <[EMAIL PROTECTED]> wrote:
> I'm trying to jump on the TDD/BDD bandwagon, but am having trouble
> understanding how i should mock my user. The user has a habtm
> relationship to a roles model (acl_system2 plugin), but I'm not sure
> how to tell rspec about a model.
>
>
I'm trying to jump on the TDD/BDD bandwagon, but am having trouble
understanding how i should mock my user. The user has a habtm
relationship to a roles model (acl_system2 plugin), but I'm not sure
how to tell rspec about a model.
My code:
describe UsersController do
integrate_views
before(