Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
HackHackHack...

Martin Asser Hansen maasha

💭
HackHackHack...
View GitHub Profile
View gist:5386254
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
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
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
@maasha
maasha / gist:5337159
Last active Dec 15, 2015
1) Scaffold pages show Failure/Error: visit user_scaffold_path(user, user.scaffolds.first) ActionView::Template::Error: undefined method `name' for nil:NilClass # ./app/views/scaffolds/show.html.erb:1:in `_app_views_scaffolds_show_html_erb___4043736085633253445_70230076755880' # ./spec/requests/scaffold_pages_spec.rb:46:in `block (3 levels) in …
View gist:5337159
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
<!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" />
@maasha
maasha / gist:5335637
Created Apr 8, 2013
1) Scaffold pages index pagination Failure/Error: it { should have_selector('div.pagination') } # FIXME expected css "div.pagination" to return something # ./spec/requests/scaffold_pages_spec.rb:27:in `block (4 levels) in <top (required)>'
View gist:5335637
require 'spec_helper'
describe "Scaffold pages" do
subject { page }
describe "index" do
let(:user) { FactoryGirl.create(:user) }
before do
sign_in user
@maasha
maasha / gist:5335260
Created Apr 8, 2013
1) Scaffold pages index pagination Failure/Error: it { should have_selector('div.pagination') } # FIXME expected css "div.pagination" to return something # ./spec/requests/scaffold_pages_spec.rb:27:in `block (4 levels) in <top (required)>'
View gist:5335260
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
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
@maasha
maasha / gist:5319035
Last active Dec 15, 2015
1) Scaffold pages index pagination Failure/Error: let(:user) { FactoryGirl.create(:user) } ActiveRecord::RecordInvalid: Validation failed: Email has already been taken # ./spec/requests/scaffold_pages_spec.rb:7:in `block (3 levels) in <top (required)>' # ./spec/requests/scaffold_pages_spec.rb:10:in `block (3 levels) in <top (required)>'
View gist:5319035
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
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