Skip to content
This repository has been archived by the owner on Apr 26, 2022. It is now read-only.

Commit

Permalink
Adds spec for board view. Fixes #169.
Browse files Browse the repository at this point in the history
  • Loading branch information
mezis committed Nov 21, 2013
1 parent 286830e commit 6980646
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions spec/views/ideas/_board.html.haml_spec.rb
@@ -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

0 comments on commit 6980646

Please sign in to comment.