Sha256: 2c60cb3f9a6d3111b6c43cc1198f0a7c7cc05fd2982cafbd80c6bcdd090d3ac2

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'
require 'xiv_lodestone/lodestone_character_attribute'

describe XIVLodestone::AttributeList do
  let (:valid) {
    XIVLodestone::AttributeList.new(Nokogiri::HTML(open(LOCAL_FILE)).
      xpath('//div[starts-with(@class,"param_left_area_inner")]/ul/li'))
  }

  let (:invalid) {
    XIVLodestone::AttributeList.new(Nokogiri::HTML(open(INVALID_FILE)).
      xpath('//div[starts-with(@class, "param_left_area_inner")]/ul/li'))
  }

  it 'to json dump check' do
    expect(valid.to_json).to eq("{\"str\":109,\"dex\":213,\"vit\":422,\"int\":211,\"mnd\":539,\"pie\":408,\"fire\":270,\"ice\":267,\"wind\":271,\"earth\":269,\"lightning\":269,\"water\":269,\"accuracy\":405,\"critical_hit_rate\":424,\"determination\":320,\"defense\":318,\"parry\":341,\"magic_defense\":545,\"attack_power\":109,\"skill_speed\":341,\"attack_magic_potency\":211,\"healing_magic_potency\":539,\"spell_speed\":415,\"slow_resistance\":0,\"silence_resistance\":0,\"blind_resistance\":0,\"poison_resistance\":0,\"stun_resistance\":0,\"sleep_resistance\":0,\"bind_resistance\":0,\"heavy_resistance\":0,\"slashing\":100,\"piercing\":100,\"blunt\":100}")
    expect(invalid.to_json).to eq("{}")
    expect(valid.to_json.is_a?(String)).to eq(true)
  end

  it 'method missing check' do
    expect(valid.method_missing(:str)).to eql(109)
    expect(valid.method_missing(:dex)).to eql(213)
    expect(valid.method_missing(:fire)).to eql(270)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xiv_lodestone-0.0.5 spec/xiv_lodestone_character_attribute_spec.rb