-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
81 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Fabricator(:comment) do | ||
report_id 1 | ||
user_id 1 | ||
report! | ||
user! | ||
body "MyText" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Fabricator(:report) do | ||
date "2012-01-31" | ||
user_id 1 | ||
user! | ||
body "MyText" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,34 @@ | ||
# coding: utf-8 | ||
require 'spec_helper' | ||
|
||
describe Comment do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
describe '.create' do | ||
let(:comment) { Fabricate :comment } | ||
subject { comment } | ||
context 'パラメータが正しい時' do | ||
it { should be_valid } | ||
end | ||
context '本文が空の時' do | ||
before do | ||
comment.body = '' | ||
end | ||
it { should_not be_valid } | ||
end | ||
end | ||
describe '#destroy' do | ||
let(:comment) { Fabricate :comment } | ||
subject { Comment.where(comment.id).first } | ||
context '日報が削除された時' do | ||
before do | ||
comment.report.destroy | ||
end | ||
it { should be_nil } | ||
end | ||
context 'ユーザーが削除された時' do | ||
before do | ||
comment.user.destroy | ||
end | ||
it { should be_nil } | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,49 @@ | ||
# coding: utf-8 | ||
require 'spec_helper' | ||
|
||
describe Report do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
describe '.create' do | ||
let(:report) { Fabricate :report } | ||
subject { report } | ||
context 'パラメータが正しいとき' do | ||
it { should be_valid } | ||
end | ||
context '本文が空の時' do | ||
before do | ||
report.body = '' | ||
end | ||
it { should_not be_valid } | ||
end | ||
context '日付が空の時' do | ||
before do | ||
report.date = nil | ||
end | ||
it { should_not be_valid } | ||
end | ||
end | ||
describe '.latest_date' do | ||
subject { Report.latest_date } | ||
before do | ||
Fabricate(:report, :date => '2012-01-01') | ||
end | ||
context '2012-01-01 の日報だけがあるとき' do | ||
it { should == Date.parse('2012-01-01') } | ||
end | ||
context 'さらに 2012-01-02 の日報があるとき' do | ||
before do | ||
Fabricate(:report, :date => '2012-01-02') | ||
end | ||
it { should == Date.parse('2012-01-02') } | ||
end | ||
end | ||
describe '#destroy' do | ||
let(:report) { Fabricate :report } | ||
subject { Report.where(report.id).first } | ||
context 'ユーザーが削除された時' do | ||
before do | ||
report.user.destroy | ||
end | ||
it { should be_nil } | ||
end | ||
end | ||
end |