Blog

index.erb for Testing Sinatra Ruby Framework CRUD Operations with RSpec and Capybara Gems
Posted on August 10, 2015 in Ruby, Sinatra by Matt Jennings

See this post for a full describe of files used in a Sinatra Ruby framework for CRUD (Create Read Update Delete) operations with RSpec and Capybara testing.

/views/projects/index.erb

<!doctype>
<html>
<head>
    <title>All Projects</title>
    <link rel="stylesheet" type="text/css" href="css/styles.css" />
</head>

<body>

<div id="wrapper">

  <h1>All Projects</h1>

  <ul id="projects-list">
    <% @projects.reverse.each do |p| %>
        <li><strong>Name:</strong> <%= p.name %><br /><strong>Description:</strong> <%= p.description %><br />
          <a href="/projects/<%= p.id %>">&raquo; Show Project</a></li>
    <% end %>
  </ul>

  <p>&nbsp;</p>

  <p class="important"><a href="/projects/new">&raquo; Add New Project</a></p>

</div>

</body>
</html>

Leave a Reply

To Top ↑