Sha256: 96f88dd95b4df4763833f47ae63763eaaf93907918b6a936625de5178045ed5e

Contents?: true

Size: 640 Bytes

Versions: 2

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe TriviaCrack::Parsers::SessionParser do
  describe '.parse' do
    subject { TriviaCrack::Parsers::SessionParser.parse raw_data }

    context 'when given data from the login API' do
      let(:raw_data) { SpecData.get_json 'login.json' }

      it { is_expected.to be_a TriviaCrack::Session }
      its(:user_id) { is_expected.to be 111 }
      its(:username) { is_expected.to eq 'example' }
      its(:session_id) { is_expected.to eq 'session123' }
      its(:device_key) { is_expected.to eq 'device123' }
      its(:expiration) { is_expected.to be_a Time }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
triviacrack-0.8.0 spec/parsers/session_parser_spec.rb
triviacrack-0.7.0 spec/parsers/session_parser_spec.rb