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
# First attempting to use Capybara directly, you will ran into issues when trying to set HTTP header. | |
# Using Basic HTTP Authentication requires that we needed to set the header. | |
# Also we need to set the Content-Type and Accept headers to ensure that Rails handles the input and output correctly. | |
# When using Rack, Capybara delegates request and response handling down to Rack::Test. | |
# So I used Rack::Test directly in my step definitions, and it works. | |
# Rack::Test has a module called Rack::Test::Methods that can be mixed into a class to provide it | |
# with methods for get, post, put, delete as well as last_request, last_response, header and more. | |
# I mixed Rack::Test::Methods into the Cucumber world at the top of our API steps file like so: | |
############################## |
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
<% 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
<!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
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
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
$:.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
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
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
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 |