Sha256: 78003a833440130036c4f6bdb449e630fde0251ae6cf4f443c0a4ee75f5f3ca1
Contents?: true
Size: 1.45 KB
Versions: 42
Compression:
Stored size: 1.45 KB
Contents
require 'spec_helper' describe "/accounts/_account.html.erb" do let(:account) { Factory.stub(:account) } let(:edit_link) { %{href="#{edit_account_path(account)}"} } let(:user) { Factory.stub(:user) } before { view.stubs(:current_user => user) } def render_account render :partial => "accounts/account", :locals => { :account => account } end context "admin" do before do user.stubs(:admin_of? => true) render_account end it "links to edit the account" do rendered.should include(edit_link) end end context "non admin" do before do user.stubs(:admin_of? => false) render_account end it "links to edit the account" do rendered.should_not include(edit_link) end end context "with projects" do let(:project) { Factory.stub(:project, :name => 'Test Project') } before do account.stubs(:projects_visible_to => [project]) render_account end it "finds visible projects" do account.should have_received(:projects_visible_to).with(user) end it "renders projects" do rendered.should include(project.name) end it "doesn't render the blank slate" do rendered.should_not include("blank_slate") end end context "without projects" do before do account.stubs(:projects_visible_to => []) render_account end it "renders the blank slate" do rendered.should include("blank_slate") end end end
Version data entries
42 entries across 42 versions & 1 rubygems