Jim's
Tutorials

Fall 2018
course
site

I worked on testing server issues using pry. I actually started this, this week and did most of it the following week, so next week I include 2 weeks worth of testing material.

Anyway I tested the same file I made and put in ruby, like this:

<% require 'pry' %>
<% binding.pry %>

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Veggie Recipe Printer</title>
</head>

<body>
    <h1>Veggie Recipie Printer</h1>

<ul>
<% @ingredients.each do |ingredient| %>

<li>
<a href= "/ingredients/<%= ingredient %>"><%= ingredient %></a>
</li>
<% end %>
</ul>

<ol>
        <% @directions.each do |direction| %>

        <li>
            <a href = "/directions/<%= direction %>"><%= direction %></a>
        </li>
        <% end %>
        </ol>


</body>
</html>


OUTPUT:

ruby server.rb
WARN: Unresolved specs during Gem::Specification.reset:
      activesupport (>= 4.0.0)
      multi_json (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
== Sinatra (v2.0.4) has taken the stage on 4567 for development with backup from Puma
Puma starting in single mode...
* Version 3.11.0 (ruby 2.3.3-p222), codename: Love Song
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://0.0.0.0:4567
Use Ctrl-C to stop

From: /Users/lesliewilson/marlboro_rails/veggie-recipe-printer-sinatra/views/index.erb @ line 2 :

    1: <% require 'pry' %>
 => 2: <% binding.pry %>
    3:
    4: <!DOCTYPE html>
    5: <html lang="en">
    6: <head>
    7:   <meta charset="utf-8">

[1] pry(#<Sinatra::Application>)> @directions
=> ["Preheat oven to 400 degrees F.",
 "Cut off the brown ends of the Brussels sprouts.",
 "Pull off any yellow outer leaves.",
 "Mix them in a bowl with the olive oil, salt and pepper.",
 "Pour them on a sheet pan and roast for 35 to 40 minutes.",
 "They should be until crisp on the outside and tender on the inside.",
 "Shake the pan from time to time to brown the sprouts evenly.",
 "Sprinkle with more kosher salt ( I like these salty like French fries).",
 "Serve and enjoy!"]
[2] pry(#<Sinatra::Application>)> @ingredients
=> ["1 1/2 pounds Brussels sprouts", "3 tablespoons good olive oil", "3/4 teaspoon kosher salt", "1/2 teaspoon freshly ground black pepper"]
[3] pry(#<Sinatra::Application>)>