require "spec_helper" module Fonte module Parsers describe PlayerParser do let(:parser) { described_class.new } let(:player) { "Reu<2>" } subject { parser.parse(player) } its(:"nickname.value") { should == "Reu" } its(:"uid.value") { should == 2 } its(:"steam_id.value") { should == "STEAM_1:1:24968171" } its(:"team.value") { should == "Red" } context "when the player is a bot" do let(:player) { "Nick<42>" } its(:"steam_id.value") { should be_nil } end context "when the player is the console" do let(:player) { "Console<0>" } its(:"steam_id.value") { should be_nil } its(:"team.value") { should be_nil } end context "when the team is not present" do let(:player) { "Reu<2><>" } its(:"team.value") { should be_nil } end context "when the team is unissiged" do let(:player) { "Reu<2>" } its(:"team.value") { should be_nil } end end end end