This repository has been archived by the owner on Apr 26, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds spec for board view. Fixes #169.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# encoding: UTF-8 | ||
require 'spec_helper' | ||
|
||
describe "ideas/_board.html.haml" do | ||
fixtures :users, :logins, :accounts | ||
|
||
let(:ideas) { Array.new } | ||
let(:idea_counts) { Hash.new } | ||
let(:local_assigns) { Hash.new } | ||
let(:user) { users(:abigale_balisteri) } | ||
|
||
login_user :user | ||
|
||
subject do | ||
render partial:'ideas/board', locals:local_assigns | ||
rendered | ||
end | ||
|
||
before do | ||
stub_template 'ideas/_idea_mini.html.haml' => '= idea.title' | ||
assign :ideas, ideas | ||
assign :idea_counts, idea_counts | ||
end | ||
|
||
it 'should render submitted and picked ideas' do | ||
ideas.push double(state: 0, title: 'submitted idea') | ||
ideas.push double(state: 3, title: 'picked idea') | ||
subject.should =~ /submitted idea/ | ||
subject.should =~ /picked idea/ | ||
end | ||
|
||
it 'should not render drafts' do | ||
ideas.push double(state: -1, title: 'draft idea') | ||
subject.should_not =~ /draft idea/ | ||
end | ||
|
||
it 'should display the number of hidden ideas' do | ||
ideas.push double(state: 0, title: 'submitted idea') | ||
idea_counts[:submitted] = 999 | ||
subject.should =~ /\b998\b/ | ||
end | ||
|
||
end |