使用rails 5获取功能规格中的空白页面

时间:2017-08-16 13:56:42

标签: ruby-on-rails capybara rspec-rails

我正在为登录过程编写功能规范。

describe 'the signin process', type: :feature do
  let(:user) { FactoryGirl.create(:user) }

  it 'Should login with valid email password' do
    visit('/')
    fill_in 'user[email]', with: user.email
    fill_in 'user[password]', with: user.password
    click_button 'Log In'
    puts page.body
    expect(page).to have_content "Hello, you're managing"
  end
end

put page.body正在打印:

<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body></body></html>

使用导轨5时。 但它正在使用rails 3.它在使用rails 3时打印了我主页的整页内容。

有人能帮助我,请问有什么问题吗?

application.html.haml

!!! transitional
%html(xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en")
  %head
    %meta{"http-equiv" => "X-UA-Compatible", :content => "chrome=1"}
    %meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}
    %link{:rel => "shortcut icon", :href => "/favicon.ico"}
    %title
      UgMO -
    = yield(:title) || "Save Water, Save Money, Save Earth"
    = stylesheet_link_tag 'application', :media => "all"
    = javascript_include_tag 'application' 
    = csrf_meta_tags
    = yield(:head)
  %body{:class => "#{controller_name} #{action_name}"}
    = yield

0 个答案:

没有答案