require "rails_helper"

feature "Guest account sign up" do
  scenario "creates a new account and signs in successfully" do
    visit new_account_path

    fill_in "Email", with: "user+1@test.com"
    fill_in "Password", with: "password"
    fill_in "Account Name", with: "Test Account"

    click_on "Start Free Trial"

    expect(page).to have_content "We are excited to help you organize and automate your media projects. Click below to create your first project and get started."
    expect(page).to have_content "Welcome"
    expect(page).to have_link "Create Your First Project"
  end

  scenario "navivates to new account page when account creation fails" do
    visit new_account_path

    fill_in "Email", with: "user+1@test.com"
    fill_in "Password", with: "password"
    fill_in "Account Name", with: ""

    click_on "Start Free Trial"

    expect(page).to have_content "Sign Up"
  end

  scenario "navivates to new account page when user creation fails" do
    visit new_account_path

    fill_in "Email", with: ""
    fill_in "Password", with: "password"
    fill_in "Account Name", with: "Test Account"

    click_on "Start Free Trial"

    expect(page).to have_content "Sign Up"
  end
end
