This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "User pages" do | |
subject { page } | |
describe "profile page" do | |
let(:user) {FactoryGirl.create(:user) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FactoryGirl.define do | |
factory :user do | |
name "Albert McKeever" | |
email "kotn_ep1@hotmail.com" | |
password "$a36Le" | |
password_confirmation "$a36Le" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$:.unshift File.expand_path('..', __FILE__) | |
$:.unshift File.expand_path('../../lib', __FILE__) | |
require 'simplecov' | |
require 'simplecov-rcov' | |
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter | |
SimpleCov.start | |
require 'rubygems' | |
require 'rspec' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UsersController < ApplicationController | |
# GET /users | |
# GET /users.json | |
def index | |
@users = User.all | |
respond_to do |format| | |
format.html # index.html.erb | |
format.json { render json: @users } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SessionsHelper | |
def sign_in(user) | |
cookies.permanent[:remember_token] = user.remember_token | |
self.current_user = user | |
end | |
def current_user=(user) | |
@current_user = user | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title><%= full_title(yield(:title)) %> - Work In Progress</title> | |
<%= stylesheet_link_tag "application", media: "all" %> | |
<%= javascript_include_tag "application"%> | |
<%= csrf_meta_tags %> | |
<%= render 'layouts/shim' %> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% provide(:title, "Sign up") %> | |
<h1>Sign up</h1> | |
<div class="row"> | |
<div class="span6 offset3"> | |
<%= form_for(@user) do |f| %> | |
<%= render 'shared/error_messages' %> | |
<%= f.label :name %> | |
<%= f.text_field :name %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "bootstrap"; | |
/* forms */ | |
input, textarea, select, .uneditable-input { | |
border: 1px solid #bbb; | |
width: 100%; | |
padding: 10px; | |
height: auto; | |
margin-bottom: 15px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources :users | |
resources :sessions, only: [:new, :create, :destroy] | |
match '/signup', to: 'users#new' | |
match '/signin', to: 'sessions#new' | |
match '/signout', to: 'sessions#destroy', via: :delete | |
get "users/new" |