我需要检查toastr-rails中的文本消息。但在我的测试中,文字并未显示。如何用js运行rspec?或者我应该做点什么?
scenario "#email" do
fill_in "user_email", with: "johndoe@mail.com"
click_on "Save"
expect(page).to have_content 'Your account has been updated successfully'
end
我的留言模板(toastr)
<% unless flash.empty? %>
<script type="text/javascript">
<% flash.each do |f| %>
<% type = f[0].to_s.gsub('alert', 'error').gsub('notice', 'info') %>
toastr['<%= type %>']('<%= f[1] %>');
<% end %>
</script>
答案 0 :(得分:0)
我有同样的问题,这就是它的工作原理
[{"High Level Code (L1)"=>1,
"High Level Sector Description"=>"Education",
"Budget"=>11362},
{"High Level Code (L1)"=>2,
"High Level Sector Description"=>"Health",
"Budget"=>5524}]
:Capybara.javascript_driver
scenario "#email", :js => true do
fill_in "user_email", with: "johndoe@mail.com"
click_on "Save"
expect(page).to have_content 'Your account has been updated successfully'
end
内的消息 div