Sha256: ee0537aff94da5b017bac8e6bfb66a2b57960dd578b9bae3b4b6da0103d1b07d
Contents?: true
Size: 1.94 KB
Versions: 1
Compression:
Stored size: 1.94 KB
Contents
require "spec_helper" describe TriviaCrack::Parsers::UserParser do describe ".parse" do subject { TriviaCrack::Parsers::UserParser.parse raw_data } context 'when given data from the user API' do let(:raw_data) { SpecData.get_json "user.json" } it { is_expected.to be_a TriviaCrack::User } its(:id) { is_expected.to be 111 } its(:username) { is_expected.to eq "example" } its(:facebook_id) { is_expected.to eq "1" } its(:facebook_name) { is_expected.to eq "Example Name" } its(:coins) { is_expected.to be 111 } its(:lives) { is_expected.to be 3 } its(:max_lives) { is_expected.to be 3 } its(:unlimited_lives) { is_expected.to be false } its(:country) { is_expected.to be :ca } its(:extra_shots) { is_expected.to be 3 } its(:level) { is_expected.to be 31 } its(:level_points) { is_expected.to be 546 } its(:level_progress) { is_expected.to be 63 } its(:goal_points) { is_expected.to be 558 } its(:level_up) { is_expected.to be false } end context 'when given opponent data from the game API' do let(:raw_data) { SpecData.get_json("game.json")["opponent"] } it { is_expected.to be_a TriviaCrack::User } its(:id) { is_expected.to be 111 } its(:username) { is_expected.to eq "example.2" } its(:facebook_id) { is_expected.to eq "" } its(:facebook_name) { is_expected.to be nil } its(:coins) { is_expected.to be nil } its(:lives) { is_expected.to be nil } its(:max_lives) { is_expected.to be nil } its(:unlimited_lives) { is_expected.to be nil } its(:country) { is_expected.to be nil } its(:extra_shots) { is_expected.to be nil } its(:level) { is_expected.to be 116 } its(:level_points) { is_expected.to be nil } its(:level_progress) { is_expected.to be nil } its(:goal_points) { is_expected.to be nil } its(:level_up) { is_expected.to be nil } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
triviacrack-0.6.0 | spec/parsers/user_parser_spec.rb |