Skip to content

Instantly share code, notes, and snippets.

View alanmaciel's full-sized avatar
Work and play, same thing, differing conditions. ~Mark Twain

Alan Maciel alanmaciel

Work and play, same thing, differing conditions. ~Mark Twain
View GitHub Profile
require 'spec_helper'
describe "Deleting a movie" do
it "destroys the movie and shows the movie listing without the deleted movie" do
movie = Movie.create(movie_attributes)
visit movie_path(movie)
click_link 'Delete'
require 'spec_helper'
describe "Creating a new review" do
it "saves the review" do
movie = Movie.create(movie_attributes)
visit movie_url(movie)
click_link 'Write Review'
require_relative 'spec_helper'
describe "Creating a new movie" do
it "saves the movie and shows the new movie's details" do
visit movies_url
click_link 'Add New Movie'
expect(current_path).to eq(new_movie_path)
require 'spec_helper'
describe "Creating a new review" do
it "saves the review" do
movie = Movie.create(movie_attributes)
visit movie_url(movie)
click_link 'Write Review'
require 'spec_helper'
describe UsersController do
before do
@user = User.create!(user_attributes)
end
context "when not signed in" do
<aside id="sidebar">
<nav>
<ul>
<li class="all-movies">
<%= link_to 'All Movies', movies_path, class: 'button' %>
</li>
<li class="create-movie">
<%= link_to 'Add New Movie', new_movie_path, class: 'button' %>
</li>
</ul>
<% if object.errors.any? %>
<section id="errors">
<header>
<h2>
Oops! The <%= object.class.name.humanize.downcase %> could not be saved.
</h2>
<h3>
Please correct the following <%= pluralize(object.errors.count, "error") %>:
</h3>
</header>
rails new -d=<postgresql|mysql|sqlite> --skip-test-unit <appname>
/*
* The Pragmatic Studio
* http://pragmaticstudio.com
* Copyright (c) 2011 The Pragmatic Studio
*
* Please don't use this exact layout and style
* combination in your applications.
*/
module MoviesHelper
def format_total_gross(movie)
if movie.flop?
content_tag(:strong, 'Flop!')
else
number_to_currency(movie.total_gross)
end
end
def image_for(movie)