This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
YOSHIDA Hiroki
committed
Feb 20, 2014
1 parent
5045204
commit 62e6492
Showing
3 changed files
with
36 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
FactoryGirl.define do | ||
factory :tag do | ||
user { FactoryGirl.create(:has_clip_user) } | ||
sequence(:name) {|n| "タグ#{n}" } | ||
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'spec_helper' | ||
|
||
describe "tags/show.html.slim" do | ||
# HACK: nameパラメータを無理矢理コントローラに渡す | ||
before { controller.stub!(:params).and_return { { name: subject.name } } } | ||
|
||
before_stub_request | ||
before { assign(:tag, subject) } | ||
before { render } | ||
|
||
context "タグづけされたクリップが存在する場合" do | ||
let (:clip) { FactoryGirl.create(:clip) } | ||
|
||
subject { FactoryGirl.create(:tag, tagged: clip, tagged_type: :clip) } | ||
|
||
it "クリップが1つが表示されていること" do | ||
expect(rendered).to match /クリップ \(1\)/ | ||
end | ||
end | ||
|
||
context "タグづけされたクリップ/まとめが存在しない場合" do | ||
subject { FactoryGirl.build(:tag) } | ||
|
||
it "クリップが1つも表示されていないこと" do | ||
expect(rendered).to match /クリップ \(0\)/ | ||
end | ||
end | ||
end |