Sha256: 533b068d6908811b5327a2476933a2992548cce208da7c58b28264a65e3ecfa2

Contents?: true

Size: 1.06 KB

Versions: 14

Compression:

Stored size: 1.06 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 "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

14 entries across 14 versions & 1 rubygems

Version Path
saucy-0.2.28.1 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.38 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.36 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.35 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.34 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.33 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.32 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.31 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.30 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.29 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.28 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.27 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.26 spec/views/accounts/_account.html.erb_spec.rb
saucy-0.2.25 spec/views/accounts/_account.html.erb_spec.rb