Skip to content

Instantly share code, notes, and snippets.

@CH-JesseMa
Created April 9, 2014 15:52
Show Gist options
  • Save CH-JesseMa/10285528 to your computer and use it in GitHub Desktop.
Save CH-JesseMa/10285528 to your computer and use it in GitHub Desktop.
Spec Helper Template
require 'spec_helper'
describe "the site" do
describe "new user visits homepage" do
it "says Cappy App" do
visit("/")
expect(page).to have_content "Cappy App"
end
it "displays image" do
visit("/")
expect(page.has_css?('img[alt="giant rat"]') ).to be_true
end
it "has a signup link" do
visit root_path
click_link "Sign Up"
expect(page).to have_content "Please enter your name"
expect(current_path).to eq "/users/new"
end
describe "creating a user" do
describe "signing up with valid credentials" do
it "takes us to homepage and say thanks for signing up" do
let(:user) {FactoryGirl.build(:user)}
sign_up(user)
expect(current_path).to eq root_path
expect(page).to have_content "Thanks for signing up!"
end
end
describe "signing up with invalid credentials" do
end
end
end
end
def sign_up(user)
visit root_path
click_link "Sign Up"
fill_in"Email", with: user.Email
click_button "Sign Up"
end
def login(user)
end
#gem 'factory_girl_rails'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment