require 'spec_helper'

describe "the user is not a mentor" do

  let(:customer) { create :customer }

  it "should not see the manage trades link" do
    login_as_user customer
    page.should_not have_css "#mentor_passions_link"
  end

  it "should not be allowed to visit the manage trades page" do
    login_as_user customer
    visit mentor_passions_path
    current_path.should eq home_path
  end

end

describe "the mentor clicks the manage trades button" do
  it "should be redirected to the manage trades page" do
    mentor = create :mentor
    login_as_user mentor
    click_link "mentor_passions_link"
    current_path.should eq mentor_passions_path
  end

  it 'should pdate tutur trades', js: true do
    mentor = create :mentor
    login_as_user mentor
    click_link "mentor_passions_link"
    find('#trades_form').visible?.should be_false
    find('button#hide_trades_form').visible?.should be_false
    click_button 'show_trades_form'

    find('#trades_form').visible?.should be_true
    find('button#show_trades_form').visible?.should be_false
    find('button#hide_trades_form').visible?.should be_true
    click_button 'hide_trades_form'
    find('#trades_form').visible?.should be_false
    find('button#hide_trades_form').visible?.should be_false

  end

end
