require 'rails_helper'

describe Skills do
  before :each do
    @data = [CoreStats.new([{:attributes=>["Dexterity"], :value=>2}, {:attributes=>["Charisma"], :value=>1}], "standard array", nil), ["acrobatics", "performance"], "choose two from history, insight, medicine, persuasion, and religion"]
  end

  it "exists" do
    skills = Skills.new(@data[0].stats[:modifiers], @data[1], @data[2], nil, 2)

    expect(skills).to be_a(Skills)
    expect(skills.proficiencies).to be_a(Array)
    expect(skills.proficiencies[0]).to eq("acrobatics")
    expect(skills.proficiencies[1]).to eq("performance")
    expect(skills.proficiencies[2]).to be_a(String)
    expect(skills.proficiencies[3]).to be_a(String)
    expect(skills.proficiencies[4]).to be_a(NilClass)
    expect(skills.skills[:acrobatics]).to be_a(Integer)
    expect(skills.skills[:animal_handling]).to be_a(Integer)
    expect(skills.skills[:arcana]).to be_a(Integer)
    expect(skills.skills[:athletics]).to be_a(Integer)
    expect(skills.skills[:deception]).to be_a(Integer)
    expect(skills.skills[:history]).to be_a(Integer)
    expect(skills.skills[:insight]).to be_a(Integer)
    expect(skills.skills[:intimidation]).to be_a(Integer)
    expect(skills.skills[:investigation]).to be_a(Integer)
    expect(skills.skills[:medicine]).to be_a(Integer)
    expect(skills.skills[:nature]).to be_a(Integer)
    expect(skills.skills[:perception]).to be_a(Integer)
    expect(skills.skills[:performance]).to be_a(Integer)
    expect(skills.skills[:persuasion]).to be_a(Integer)
    expect(skills.skills[:religion]).to be_a(Integer)
    expect(skills.skills[:sleight_of_hand]).to be_a(Integer)
    expect(skills.skills[:stealth]).to be_a(Integer)
    expect(skills.skills[:survival]).to be_a(Integer)
  end

  it "has class_prof of 'choose any three'" do
    skills = Skills.new(@data[0].stats[:modifiers], @data[1], 'choose any three', nil, 2)

    expect(skills).to be_a(Skills)
    expect(skills.proficiencies).to be_a(Array)
    expect(skills.proficiencies[0]).to eq("acrobatics")
    expect(skills.proficiencies[1]).to eq("performance")
    expect(skills.proficiencies[2]).to be_a(String)
    expect(skills.proficiencies[3]).to be_a(String)
    expect(skills.proficiencies[4]).to be_a(String)
    expect(skills.proficiencies[5]).to be_a(NilClass)
    expect(skills.skills[:acrobatics]).to be_a(Integer)
    expect(skills.skills[:animal_handling]).to be_a(Integer)
    expect(skills.skills[:arcana]).to be_a(Integer)
    expect(skills.skills[:athletics]).to be_a(Integer)
    expect(skills.skills[:deception]).to be_a(Integer)
    expect(skills.skills[:history]).to be_a(Integer)
    expect(skills.skills[:insight]).to be_a(Integer)
    expect(skills.skills[:intimidation]).to be_a(Integer)
    expect(skills.skills[:investigation]).to be_a(Integer)
    expect(skills.skills[:medicine]).to be_a(Integer)
    expect(skills.skills[:nature]).to be_a(Integer)
    expect(skills.skills[:perception]).to be_a(Integer)
    expect(skills.skills[:performance]).to be_a(Integer)
    expect(skills.skills[:persuasion]).to be_a(Integer)
    expect(skills.skills[:religion]).to be_a(Integer)
    expect(skills.skills[:sleight_of_hand]).to be_a(Integer)
    expect(skills.skills[:stealth]).to be_a(Integer)
    expect(skills.skills[:survival]).to be_a(Integer)
  end

  it "has class_prof starting with 'choose four skills from '" do
    skills = Skills.new(@data[0].stats[:modifiers], @data[1], 'choose four skills from arcana, athletics, history, insight, medicine, persuasion, and religion', nil, 2)

    expect(skills).to be_a(Skills)
    expect(skills.proficiencies).to be_a(Array)
    expect(skills.proficiencies[0]).to eq("acrobatics")
    expect(skills.proficiencies[1]).to eq("performance")
    expect(skills.proficiencies[2]).to be_a(String)
    expect(skills.proficiencies[3]).to be_a(String)
    expect(skills.proficiencies[4]).to be_a(String)
    expect(skills.proficiencies[5]).to be_a(String)
    expect(skills.proficiencies[6]).to be_a(NilClass)
    expect(skills.skills[:acrobatics]).to be_a(Integer)
    expect(skills.skills[:animal_handling]).to be_a(Integer)
    expect(skills.skills[:arcana]).to be_a(Integer)
    expect(skills.skills[:athletics]).to be_a(Integer)
    expect(skills.skills[:deception]).to be_a(Integer)
    expect(skills.skills[:history]).to be_a(Integer)
    expect(skills.skills[:insight]).to be_a(Integer)
    expect(skills.skills[:intimidation]).to be_a(Integer)
    expect(skills.skills[:investigation]).to be_a(Integer)
    expect(skills.skills[:medicine]).to be_a(Integer)
    expect(skills.skills[:nature]).to be_a(Integer)
    expect(skills.skills[:perception]).to be_a(Integer)
    expect(skills.skills[:performance]).to be_a(Integer)
    expect(skills.skills[:persuasion]).to be_a(Integer)
    expect(skills.skills[:religion]).to be_a(Integer)
    expect(skills.skills[:sleight_of_hand]).to be_a(Integer)
    expect(skills.skills[:stealth]).to be_a(Integer)
    expect(skills.skills[:survival]).to be_a(Integer)
  end

  it "has class_prof starting with 'choose four from '" do
    skills = Skills.new(@data[0].stats[:modifiers], @data[1], 'choose four from arcana, athletics, history, insight, medicine, persuasion, and religion', nil, 2)

    expect(skills).to be_a(Skills)
    expect(skills.proficiencies).to be_a(Array)
    expect(skills.proficiencies[0]).to eq("acrobatics")
    expect(skills.proficiencies[1]).to eq("performance")
    expect(skills.proficiencies[2]).to be_a(String)
    expect(skills.proficiencies[3]).to be_a(String)
    expect(skills.proficiencies[4]).to be_a(String)
    expect(skills.proficiencies[5]).to be_a(String)
    expect(skills.proficiencies[6]).to be_a(NilClass)
    expect(skills.skills[:acrobatics]).to be_a(Integer)
    expect(skills.skills[:animal_handling]).to be_a(Integer)
    expect(skills.skills[:arcana]).to be_a(Integer)
    expect(skills.skills[:athletics]).to be_a(Integer)
    expect(skills.skills[:deception]).to be_a(Integer)
    expect(skills.skills[:history]).to be_a(Integer)
    expect(skills.skills[:insight]).to be_a(Integer)
    expect(skills.skills[:intimidation]).to be_a(Integer)
    expect(skills.skills[:investigation]).to be_a(Integer)
    expect(skills.skills[:medicine]).to be_a(Integer)
    expect(skills.skills[:nature]).to be_a(Integer)
    expect(skills.skills[:perception]).to be_a(Integer)
    expect(skills.skills[:performance]).to be_a(Integer)
    expect(skills.skills[:persuasion]).to be_a(Integer)
    expect(skills.skills[:religion]).to be_a(Integer)
    expect(skills.skills[:sleight_of_hand]).to be_a(Integer)
    expect(skills.skills[:stealth]).to be_a(Integer)
    expect(skills.skills[:survival]).to be_a(Integer)
  end

  it "has class_prof starting with 'choose three from '" do
    skills = Skills.new(@data[0].stats[:modifiers], ["nature", "perception"], 'choose three from arcana, athletics, history, insight, medicine, persuasion, and religion', nil, 2)

    expect(skills).to be_a(Skills)
    expect(skills.proficiencies).to be_a(Array)
    expect(skills.proficiencies[0]).to eq("nature")
    expect(skills.proficiencies[1]).to eq("perception")
    expect(skills.proficiencies[2]).to be_a(String)
    expect(skills.proficiencies[3]).to be_a(String)
    expect(skills.proficiencies[4]).to be_a(String)
    expect(skills.proficiencies[5]).to be_a(NilClass)
    expect(skills.skills[:acrobatics]).to be_a(Integer)
    expect(skills.skills[:animal_handling]).to be_a(Integer)
    expect(skills.skills[:arcana]).to be_a(Integer)
    expect(skills.skills[:athletics]).to be_a(Integer)
    expect(skills.skills[:deception]).to be_a(Integer)
    expect(skills.skills[:history]).to be_a(Integer)
    expect(skills.skills[:insight]).to be_a(Integer)
    expect(skills.skills[:intimidation]).to be_a(Integer)
    expect(skills.skills[:investigation]).to be_a(Integer)
    expect(skills.skills[:medicine]).to be_a(Integer)
    expect(skills.skills[:nature]).to be_a(Integer)
    expect(skills.skills[:perception]).to be_a(Integer)
    expect(skills.skills[:performance]).to be_a(Integer)
    expect(skills.skills[:persuasion]).to be_a(Integer)
    expect(skills.skills[:religion]).to be_a(Integer)
    expect(skills.skills[:sleight_of_hand]).to be_a(Integer)
    expect(skills.skills[:stealth]).to be_a(Integer)
    expect(skills.skills[:survival]).to be_a(Integer)
  end

  it "has class_prof starting with 'choose two skills from '" do
    skills = Skills.new(@data[0].stats[:modifiers], ["animal_handling", "nature"], 'choose two skills from arcana, athletics, history, insight, medicine, persuasion, and religion', nil, 2)

    expect(skills).to be_a(Skills)
    expect(skills.proficiencies).to be_a(Array)
    expect(skills.proficiencies[0]).to eq("animal_handling")
    expect(skills.proficiencies[1]).to eq("nature")
    expect(skills.proficiencies[2]).to be_a(String)
    expect(skills.proficiencies[3]).to be_a(String)
    expect(skills.proficiencies[4]).to be_a(NilClass)
    expect(skills.skills[:acrobatics]).to be_a(Integer)
    expect(skills.skills[:animal_handling]).to be_a(Integer)
    expect(skills.skills[:arcana]).to be_a(Integer)
    expect(skills.skills[:athletics]).to be_a(Integer)
    expect(skills.skills[:deception]).to be_a(Integer)
    expect(skills.skills[:history]).to be_a(Integer)
    expect(skills.skills[:insight]).to be_a(Integer)
    expect(skills.skills[:intimidation]).to be_a(Integer)
    expect(skills.skills[:investigation]).to be_a(Integer)
    expect(skills.skills[:medicine]).to be_a(Integer)
    expect(skills.skills[:nature]).to be_a(Integer)
    expect(skills.skills[:perception]).to be_a(Integer)
    expect(skills.skills[:performance]).to be_a(Integer)
    expect(skills.skills[:persuasion]).to be_a(Integer)
    expect(skills.skills[:religion]).to be_a(Integer)
    expect(skills.skills[:sleight_of_hand]).to be_a(Integer)
    expect(skills.skills[:stealth]).to be_a(Integer)
    expect(skills.skills[:survival]).to be_a(Integer)
  end

end
