authlogic flash [:notice]没有出现在黄瓜webrat步骤 [英] authlogic flash[:notice] does not show up in cucumber webrat step

查看:202
本文介绍了authlogic flash [:notice]没有出现在黄瓜webrat步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用黄瓜运行BDD步骤以实现我的自我登录行为。

 场景:登录
注册用户:test@test.com,密码:p @ ssword存在
我在主页
当我按照登录
我填写用户名和test@test.com
我用p @ ssword填写密码
我打开页面
然后按登录
我打开页面
然后我应该看到登录成功!
我应该看到退出

这是我的情况, p>

 然后我应该看到登录成功! 

我的黄瓜步骤失败,但只在webrat。我调试与launchy和当网页appeard有确实没有消息,但在开发模式,当我运行脚本/服务器,我看到我的消息。
我的控制器看起来像这样

  def create 
@user_session = UserSession.new(params [:user_session ])
if @ user_session.save
flash [:notice] =登录成功!
redirect_to root_url
else
render:action => 'new'
end

end



是的,我看到这个
http://github.com/binarylogic/authlogic/issuesearch?state=open&q=cucumber+flash#issue/142
,不明白这可以如何帮助我
这也没有帮助。



Rails / Cucumber / Webrat:redirect_to,flash [:notice] not working



我的设置是

  *** LOCAL GEMS *** 

actionmailer(2.3.8)



actionpack(2.3.8)



activerecord )



activeresource(2.3.8)



activesupport(2.3.8)



authlogic(2.1.5)



builder(2.1.2)



配置(1.1.0)



黄瓜(0.8.4,0.8.3)



cucumber-rails 0.3.2)



database_cleaner(0.5.2)



declarative_authorization(0.4.1)



diff-lcs(1.1.2)



gherkin(2.1.2,2.0.2)



json_pure(1.4.3)



launchy(0.3.5)



mysql(2.8.1)



nokogiri(1.4.2)



/ p>

pickle(0.3.0)



rack(1.2.1,1.1.0)



rack-test(0.5.4)



rails(2.3.8)



rake(0.8.7)



rspec(1.3.0)



rspec-rails 1.3.2)



语法(1.0.0)



term-ansicolor p>

thoughtbot-factory_girl(1.2.2)



trollop(1.16.2)



webrat(0.7.1)



ruby​​ 1.8.7(2010-01-10 patchlevel 249)[i486-linux]
gem 1.3.7
在Ubuntu上运行



我可以做什么让我的黄瓜步骤通过!



感谢任何帮助

解决方案

感谢raynb指点我的方向。但是unfurtunatly这个解决方案没有工作,但我发现这个页面把所有的东西在cucumber.rb ...这疯了它现在运行...



https:// webrat .lighthouseapp.com / projects / 10503-webrat / tickets / 383-reset_session-and-webrat-dont-play-nicely-with-one-another


I am running BDD steps with cucumber to implement my autlogic login behavior.

 Scenario: log in
Given a registered user: "test@test.com" with password: "p@ssword" exists
And I am on the homepage
When I follow "Log in"
And I fill in "Username" with "test@test.com"
And I fill in "Password" with "p@ssword"
And I open the page
And I press "Login"
And I open the page
Then I should see "Login successful!"
And I should see "Logout"

this is my scenario and when I hit

Then I should see "Login successful!"

my cucumber step fails but only in webrat. I debugged with launchy and when the web-page appeard there is indeed no message but in development mode, when I run script/server I see my messages. My controller looks like this

 def create
@user_session = UserSession.new(params[:user_session])
  if @user_session.save
    flash[:notice] = "Login successful!"
   redirect_to root_url
  else
    render :action => 'new'
  end

end

And yes I saw this http://github.com/binarylogic/authlogic/issuesearch?state=open&q=cucumber+flash#issue/142 and did not understand how this could help me and this also did not help

Rails/Cucumber/Webrat: redirect_to, flash[:notice] not working

my setup is

*** LOCAL GEMS ***

actionmailer (2.3.8)

actionpack (2.3.8)

activerecord (2.3.8)

activeresource (2.3.8)

activesupport (2.3.8)

authlogic (2.1.5)

builder (2.1.2)

configuration (1.1.0)

cucumber (0.8.4, 0.8.3)

cucumber-rails (0.3.2)

database_cleaner (0.5.2)

declarative_authorization (0.4.1)

diff-lcs (1.1.2)

gherkin (2.1.2, 2.0.2)

json_pure (1.4.3)

launchy (0.3.5)

mysql (2.8.1)

nokogiri (1.4.2)

paperclip (2.3.3)

pickle (0.3.0)

rack (1.2.1, 1.1.0)

rack-test (0.5.4)

rails (2.3.8)

rake (0.8.7)

rspec (1.3.0)

rspec-rails (1.3.2)

syntax (1.0.0)

term-ansicolor (1.0.5)

thoughtbot-factory_girl (1.2.2)

trollop (1.16.2)

webrat (0.7.1)

ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux] gem 1.3.7 running on Ubuntu

What can I do to make my cucumber steps pass!

Thanks for any help

解决方案

thanks to raynb who pointed me into the right direction. But unfurtunatly this solution did not work but I found this page which puts everything in cucumber.rb... which mad it running now ...

https://webrat.lighthouseapp.com/projects/10503-webrat/tickets/383-reset_session-and-webrat-dont-play-nicely-with-one-another

这篇关于authlogic flash [:notice]没有出现在黄瓜webrat步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆