require 'spec_helper'

describe 'customers dashboard' do
  let(:customer) { create :customer }
  before { login_as_user customer }
  trade{ page }

  describe 'show complete your profile' do
    it { should have_content "Set up your Account" }
  end

  describe 'show main dashboard page' do
    it { should have_content customer.name }
  end

  #----------------------------------------------
  #Amazon Account

  describe "Customer should not be shown the alert if he has Amazon Account" do
    before do
      customer.has_amazon_account = true
      customer.save
      visit root_path
    end
    it { should_not have_content "You will need an Amazon Account to pay your fixxperts" }
  end

  #---------------------------------------------
  #Get the scoop link

  describe "click on 'Get the Scoop' link" do
    before do 
      click_link 'Get the Scoop'
    end
    describe "should show 2 links" do
      it{ should have_link "Discussions" }
      it{ should have_link "Contents" }
    end

    describe "click on Discussions link" do
      before { click_link "Discussions" }
      it { should have_content "Get the Scoop" }
      it { should have_link "Create a New Group" }
    end

    describe "click on Contents link" do
      before { click_link "Contents" }
      it { should have_content "Your Content" }
      it { should have_link "Create New Content" }
    end
  end
end