View gist:5386254
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
Failures: | |
1) Scaffold pages show | |
Failure/Error: visit scaffold_path(user, scaffold) | |
ActiveRecord::RecordNotFound: | |
Couldn't find Scaffold with id=2 [WHERE "scaffolds"."user_id" = 2] | |
# ./app/controllers/scaffolds_controller.rb:9:in `show' | |
# ./spec/requests/scaffold_pages_spec.rb:45:in `block (3 levels) in <top (required)>' | |
2) Scaffold pages show |
View gist:5362974
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 User < ActiveRecord::Base | |
attr_accessible :email, :name, :password, :password_confirmation | |
has_secure_password | |
has_many :scaffolds, dependent: :destroy | |
before_save { |user| user.email = email.downcase } | |
before_save :create_remember_token | |
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i | |
PER_PAGE = 30 # for pagination |
View gist:5362806
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
rake routes | |
users GET /users(.:format) users#index | |
POST /users(.:format) users#create | |
new_user GET /users/new(.:format) users#new | |
edit_user GET /users/:id/edit(.:format) users#edit | |
user GET /users/:id(.:format) users#show | |
PUT /users/:id(.:format) users#update | |
DELETE /users/:id(.:format) users#destroy | |
View gist:5337159
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 "index" do | |
let(:user) { FactoryGirl.create(:user) } | |
it { should have_selector('title', text: 'All scaffolds') } | |
it { should have_selector('h1', text: 'All scaffolds') } |
View gist:5335667
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>Sporenstregs | All scaffolds</title> | |
<link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" /> | |
<link href="/assets/custom.css?body=1" media="all" rel="stylesheet" type="text/css" /> | |
<link href="/assets/sessions.css?body=1" media="all" rel="stylesheet" type="text/css" /> | |
<link href="/assets/static_pages.css?body=1" media="all" rel="stylesheet" type="text/css" /> | |
<link href="/assets/tracks.css?body=1" media="all" rel="stylesheet" type="text/css" /> | |
<link href="/assets/users.css?body=1" media="all" rel="stylesheet" type="text/css" /> |
View gist:5335637
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 "Scaffold pages" do | |
subject { page } | |
describe "index" do | |
let(:user) { FactoryGirl.create(:user) } | |
before do | |
sign_in user |
View gist:5335260
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 "Scaffold pages" do | |
subject { page } | |
describe "index" do | |
let(:user) { FactoryGirl.create(:user) } | |
before do | |
sign_in user |
View gist:5319164
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 | |
sequence(:name) { |n| "Person #{n}" } | |
sequence(:email) { |n| "person_#{n}@example.com"} | |
password "foobar" | |
password_confirmation "foobar" | |
factory :admin do | |
admin true | |
end |
View gist:5319035
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 "Scaffold pages" do | |
subject { page } | |
describe "index" do | |
let(:user) { FactoryGirl.create(:user) } | |
before do | |
sign_in user |
View gist:5318658
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
rake routes | |
user_scaffolds GET /users/:user_id/scaffolds(.:format) scaffolds#index | |
POST /users/:user_id/scaffolds(.:format) scaffolds#create | |
new_user_scaffold GET /users/:user_id/scaffolds/new(.:format) scaffolds#new | |
edit_user_scaffold GET /users/:user_id/scaffolds/:id/edit(.:format) scaffolds#edit | |
user_scaffold GET /users/:user_id/scaffolds/:id(.:format) scaffolds#show | |
PUT /users/:user_id/scaffolds/:id(.:format) scaffolds#update | |
DELETE /users/:user_id/scaffolds/:id(.:format) scaffolds#destroy | |
users GET /users(.:format) users#index | |
POST /users(.:format) users#create |