Skip to content

Instantly share code, notes, and snippets.

@knwang
knwang / routes.rb
Created October 7, 2011 21:42
Proofing_oven: routes with search
ProofingOven::Application.routes.draw do
match 'ui(/:action)', controller: 'ui'
root to: 'ui#index'
resources :candidates, only: [:index] do
collection do
post :search
end
end
@knwang
knwang / index.html.haml
Created October 7, 2011 21:38
Proofing_oven: Candidates list view with search box
.search
= form_tag search_candidates_path, method: :post do
%fieldset
= text_field_tag :search, params[:search]
= submit_tag "Search"
%table.standard
%thead
%tr
- ["Name", "Phone", "Email", "Github", "Twitter", "Local", "Willing to Relocate"].each do |th|
@knwang
knwang / user_searches_candidates_by_name.feature
Created October 7, 2011 21:25
Proofing_oven: User searches candidates by name feature
@http://www.pivotaltracker.com/story/show/16870693 @candidates @filtering
Feature: User searches for candidate by name
In order to locate a candidate
As a user viewing candidates
I want search by name
- Candidates page displays text field for search
- Submitting form filters on first and last name
Background:
@knwang
knwang / candidates_controller.rb
Created October 5, 2011 02:56
Proofing_oven: Candidates Controller with sorting
class CandidatesController < ApplicationController
expose(:candidates) { Candidate.order(:first_name) }
end
@knwang
knwang / user_views_candidates.feature
Created October 5, 2011 00:36
Proofing_oven: User views candidates feature show page
@http://www.pivotaltracker.com/story/show/18733537 @candidates
Feature: User views candidates
In order to hire amazing people
As a signed in user
I want to see a list of candidates
- Candidates page displays all candidates
- Sorted by last name, first name
- Fields displayed include:
-- Name (last, first)
@knwang
knwang / candidate.rb
Created October 5, 2011 00:35
Proofing_oven: Candidate Model
class Candidate < ActiveRecord::Base
def full_name
[first_name, last_name].join(' ')
end
end
@knwang
knwang / candidate_spec.rb
Created October 5, 2011 00:35
Proofing_oven: Candidate Spec
require 'spec_helper'
describe Candidate do
subject { Fabricate(:candidate, first_name: "Joe", last_name: "Doe") }
describe "#full_name" do
its(:full_name) { should == "Joe Doe" }
end
end
@knwang
knwang / index.html.haml
Created October 5, 2011 00:33
Proofing_oven: Candidates list view
%table.standard
%thead
%tr
- ["Name", "Phone", "Email", "Github", "Twitter", "Local", "Willing to Relocate"].each do |th|
%th= th
%tbody
- candidates.each do |candidate|
%tr
%td= candidate.full_name
%td= candidate.phone
@knwang
knwang / candidates_controller.rb
Created October 5, 2011 00:23
Proofing_oven: Candidates Controller
class CandidatesController < ApplicationController
expose(:candidates) { Candidate.all }
end
@knwang
knwang / routes.rb
Created October 5, 2011 00:22
Proofing_oven: routes
ProofingOven::Application.routes.draw do
match 'ui(/:action)', controller: 'ui'
root to: 'ui#index'
resources :candidates, only: [:index]
end