Last active
August 29, 2015 14:00
-
-
Save drager/8a95e0c37d18ee67cc25 to your computer and use it in GitHub Desktop.
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
Topic | |
is valid if all parameters match (FAILED - 1) | |
Failures: | |
1) Topic is valid if all parameters match | |
Failure/Error: build(:topic).should be_valid | |
ActiveRecord::RecordInvalid: | |
Validation failed: Username has already been taken | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# C:in `object' | |
# ./spec/models/topic_spec.rb:5:in `block (2 levels) in <top (required)>' | |
Finished in 2.31 seconds | |
1 example, 1 failure | |
Failed examples: | |
rspec ./spec/models/topic_spec.rb:4 # Topic is valid if all parameters match | |
Randomized with seed 59985 |
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
# encoding: UTF-8 | |
# This file is auto-generated from the current state of the database. Instead | |
# of editing this file, please use the migrations feature of Active Record to | |
# incrementally modify your database, and then regenerate this schema definition. | |
# | |
# Note that this schema.rb definition is the authoritative source for your | |
# database schema. If you need to create the application database on another | |
# system, you should be using db:schema:load, not running all the migrations | |
# from scratch. The latter is a flawed and unsustainable approach (the more migrations | |
# you'll amass, the slower it'll run and the greater likelihood for issues). | |
# | |
# It's strongly recommended that you check this file into your version control system. | |
ActiveRecord::Schema.define(version: 20140425084406) do | |
# These are extensions that must be enabled in order to support this database | |
enable_extension "plpgsql" | |
create_table "categories", force: true do |t| | |
t.string "name" | |
t.integer "order", default: 0 | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
end | |
create_table "forums", force: true do |t| | |
t.integer "category_id" | |
t.string "name" | |
t.text "description" | |
t.integer "order", default: 0 | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
t.string "slug" | |
end | |
add_index "forums", ["slug"], name: "index_forums_on_slug", using: :btree | |
create_table "posts", force: true do |t| | |
t.integer "topic_id" | |
t.text "bodytext" | |
t.boolean "is_censored", default: false | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
t.integer "user_id" | |
end | |
create_table "topics", force: true do |t| | |
t.integer "forum_id" | |
t.string "name" | |
t.boolean "is_sticky", default: false | |
t.boolean "is_locked", default: false | |
t.integer "views", default: 0 | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
t.string "slug" | |
t.integer "user_id" | |
t.integer "last_post_id" | |
end | |
add_index "topics", ["slug"], name: "index_topics_on_slug", using: :btree | |
create_table "users", force: true do |t| | |
t.string "username" | |
t.string "first_name" | |
t.string "last_name" | |
t.string "email" | |
t.string "password_digest" | |
t.boolean "is_staff", default: false | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
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 Topic do | |
it "is valid if all parameters match" do | |
build(:topic).should be_valid | |
end | |
it { should have_many(:posts).dependent(:destroy) } | |
it { should belong_to(:forum) } | |
it { should belong_to(:user) } | |
it { should ensure_length_of(:name).is_at_least(6) } | |
it { should accept_nested_attributes_for(:posts) } | |
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 'faker' | |
FactoryGirl.define do | |
factory :topic do | |
association :forum | |
name {Faker::Name.title} | |
association :user | |
association :post | |
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 'faker' | |
FactoryGirl.define do | |
factory :user do | |
email {Faker::Internet.email} | |
username {Faker::Internet.user_name} | |
first_name {Faker::Name.first_name} | |
last_name {Faker::Name.last_name} | |
password 'test123' | |
password_confirmation 'test123' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment