Skip to content

Commit

Permalink
5.2) Move sample rails project to 5.2-bdd-demo-complete
Browse files Browse the repository at this point in the history
  • Loading branch information
dimroc committed May 13, 2012
1 parent 70bed6a commit 9243c5a
Show file tree
Hide file tree
Showing 69 changed files with 19 additions and 3 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -144,7 +144,11 @@ GEM
ffi (~> 1.0.9)
json_pure
rubyzip
shoulda (2.11.3)
shoulda (3.0.1)
shoulda-context (~> 1.0.0)
shoulda-matchers (~> 1.0.0)
shoulda-context (1.0.0)
shoulda-matchers (1.0.0)
simple_form (1.5.2)
actionpack (~> 3.0)
activemodel (~> 3.0)
Expand Down
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
class Post < ActiveRecord::Base
belongs_to :user

validates_presence_of :content
validates_presence_of :user_id
validates_presence_of :title

belongs_to :user
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -16,6 +16,15 @@
assigns(:posts).should_not be_nil
end

it "POST#create" do
title = Faker::Lorem.word
content = Faker::Lorem.paragraph
expect {
post :create, post: { title: title, content: content }
assigns(:post).should_not be_nil
}.to change { Post.count }.by(1)
end

it "GET#new" do
get :new
post = assigns(:post)
Expand Down
@@ -1,6 +1,9 @@
require 'spec_helper'

describe Post do
describe "associations" do
it { should belong_to :user }
end
describe "validations" do
it { should validate_presence_of :content }
it { should validate_presence_of :title }
Expand Down

0 comments on commit 9243c5a

Please sign in to comment.