Skip to content

Instantly share code, notes, and snippets.

View keeperofthenecklace's full-sized avatar

Albert McKeever keeperofthenecklace

  • New Jersey, U.S.A
View GitHub Profile
@keeperofthenecklace
keeperofthenecklace / gist:3388605
Created August 18, 2012 17:33
Gemfile_setupgemfile.rb
gem 'rails', '3.2.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'heroku'
gem 'newrelic_rpm'
gem 'exception_notification'
@keeperofthenecklace
keeperofthenecklace / authentication_steps.rb
Created August 18, 2012 17:35
features/step_definitions/authentication_steps
Given /^a user visits the signin page$/ do
visit signin_path
end
When /^he submits invalid information$/ do
click_button "Sign in"
end
Then /^he should see an error message$/ do
page.should have_selector('div.alert.alert-error')
@keeperofthenecklace
keeperofthenecklace / sign_in.feature
Created August 18, 2012 17:37
features/sign_in.feature
Feature: Signing in
Scenario: Unsuccessful signin
Given a user visits the signin page
When he submits invalid information
Then he should see an error message
Scenario: Successful signin
Given a user visits the signin page
And the user has an account
@keeperofthenecklace
keeperofthenecklace / sessions_controller.rb
Created August 18, 2012 17:52
spec/controller/sessions_controller
class SessionsController < ApplicationController
def new
end
def create
user = User.find_by_email(params[:session][:email])
if user && user.authenticate(params[:session][:password])
sign_in user
redirect_to user
@keeperofthenecklace
keeperofthenecklace / application_helper.rb
Created August 18, 2012 17:55
spec/helpers/application_helper.rb
require 'spec_helper'
describe ApplicationHelper do
describe "full_title" do
it "should include the page title" do
full_title("foo").should =~ /foo/
end
it "should include the base title" do
@keeperofthenecklace
keeperofthenecklace / user_spec.rb
Created August 18, 2012 17:56
spec/models/user_spec.rb
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# name :string(255)
# email :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
@keeperofthenecklace
keeperofthenecklace / authentication_pages_spec.rb
Created August 18, 2012 17:58
spec/requests/authentication_pages_spec.rb
require 'spec_helper'
describe "authentication" do
subject { page }
describe "signin page" do
before { visit signin_path }
describe "with invalid information" do
@keeperofthenecklace
keeperofthenecklace / static_pages_spec.rb
Created August 18, 2012 18:02
spec/requests/static_pages_spec.rb
require 'spec_helper'
describe "StaticPages" do
subject { page }
shared_examples_for "all static pages" do
it { should have_selector('h1', text: heading) }
it { should have_selector('title', text: full_title(page_title)) }
end
@keeperofthenecklace
keeperofthenecklace / user_pages.rb
Created August 18, 2012 18:05
spec/requests/user_pages.rb
require 'spec_helper'
describe "User pages" do
subject { page }
describe "profile page" do
let(:user) {FactoryGirl.create(:user) }
@keeperofthenecklace
keeperofthenecklace / factories.rb
Created August 18, 2012 18:07
spec/factories.rb
FactoryGirl.define do
factory :user do
name "Albert McKeever"
email "kotn_ep1@hotmail.com"
password "$a36Le"
password_confirmation "$a36Le"
end
end