require "minitest_helper"

describe "Root path acceptance test" do
  before do
    @company1 = create(:awesome_sauce_llc, featured: true)
    @company2 = create(:better_than_you_inc, featured: true)
  end

  describe "when not logged in" do
    before { visit root_path }

    it { current_path.must_equal "/" }
    it { page.must have_selector("html") }
    it { page.wont have_content("Dashboard") }
    it { page.must have_content("Awesome Sauce") }
    it { page.must have_content("Better Than You") }
  end

  describe "when logged in" do
    let(:investor) { create(:investment_profile).user }
    let(:identity) { create(:identity, user: investor) }

    before do
      login identity
      visit root_path
    end

    it { current_path.must_equal "/" }
    it { page.must have_content("Dashboard") }
  end
end