I use Capybara and Cucumber to implement integration test for my website. However the data from database (sqlite) not showing in Capybara with "print page.html"
index.html.erb:
<% provide(:title, "All posts")%>
<h3>Blogs <%= link_to "Create a post", new_post_path, class: 'pull-right' %></h3>
<%= will_paginate @posts %>
<%= render @posts %>
<%= will_paginate @posts %>
posts_controller.rb:
class PostsController < ApplicationController
def index
@posts = Post.paginate(page: params[:page], per_page: 10)
end
end
I tried to use rake db:seed RAILS_ENV=test to initial data for test environment successfully. But when I run rake cucumber
then the data from this environment is empty. How I can fix to able test data from database (sqlite) with Capybara? Thanks