Hello every one,
So my this rspec test fails:
[code]
it "should have a welcome message" do
post :create, :user => @attr
response.flash[:success].should eql("Welcome new user!")
end
[/code]
However when I create a new user the flash message does display just as
I had wanted it to.
The controller has this in it:
[code]
def create
@user = User.new(params[:user])
if @user.save
flash[:success] = "Welcome new user!"
redirect_to @user
else
@title = "Sign up"
render 'new'
end
end
def show
@user = User.find(params[:id])
@title = @user.userName
end
end
[/code]
And the view displays with:
[code]
<%= flash_helper %>
The helper is:
def flash_helper
f_names = [:success]
fl = ''
for name in f_names
if flash[name]
fl = fl + "<div class=\"notice\">#{flash[name]}</div>"
end
flash[name] = nil;
end
return fl.html_safe
end
[/code]
Like I said the flash message works just fine however the test fails any
ideas would be greatly appreciated.
Hope all is well :)
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users