Sha256: 4d20d19d16f88672e92100ad984c980d181156fc79210ce84be2fd413a7a85a2
Contents?: true
Size: 1.4 KB
Versions: 7
Compression:
Stored size: 1.4 KB
Contents
require "spec_helper" describe TriviaCrack::Parsers::CategoryStatisticsParser do describe ".parse" do subject { TriviaCrack::Parsers::CategoryStatisticsParser.parse(category_data).values.first } let(:category_data) { raw_data["statistics"]["player_one_statistics"]["category_questions"] } context 'when given data from the games API' do let(:raw_data) { SpecData.get "game.json" } it { is_expected.to be_a TriviaCrack::CategoryStatistics } its(:category) { is_expected.to be :geography } its(:correct) { is_expected.to be 2 } its(:incorrect) { is_expected.to be 1 } its(:worst) { is_expected.to be false } end context 'when given data from the dashboard API' do let(:raw_data) { SpecData.get("dashboard.json")["list"][3] } it { is_expected.to be_a TriviaCrack::CategoryStatistics } its(:category) { is_expected.to eq :arts } its(:correct) { is_expected.to be 3 } its(:incorrect) { is_expected.to be 0 } its(:worst) { is_expected.to be false } end context 'when given data from the answers API' do let(:raw_data) { SpecData.get "answer.json" } it { is_expected.to be_a TriviaCrack::CategoryStatistics } its(:category) { is_expected.to eq :sports } its(:correct) { is_expected.to be 1 } its(:incorrect) { is_expected.to be 0 } its(:worst) { is_expected.to be false } end end end
Version data entries
7 entries across 7 versions & 1 rubygems