Sha256: 1f0db6079b6f9e061763d4ff014d1d3997343a68f889652eb2d6ef902833e068

Contents?: true

Size: 915 Bytes

Versions: 1

Compression:

Stored size: 915 Bytes

Contents

require 'spec_helper'

describe "Stew::Community::ProfileGames" do
  let(:id){76561197992917668}
  let(:response){JSON.parse(IO.read('spec/fixtures/profiles/games/76561197992917668.json'))['response']['games']}

  let(:subject){Stew::Community::ProfileGames.new(response)}

  describe ".entries" do
    it "sets the games" do
      response.each do |game|
        Stew::Community::ProfileGame.should_receive(:new).with(game)
      end
      subject.entries.count.should eq 106
    end
  end

  describe ".each" do
    it "invokes the given block for each object returned by the games method" do
      game1 = double(:name => 'Half-Life 2')
      game2 = double(:name => 'Shank')
      games = [game1,game2]

      game1.should_receive(:name)
      game2.should_receive(:name)
      subject.instance_eval do
        @games = games
      end

      subject.each do |game|
        game.name
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stew-0.6.0 spec/lib/stew/community/profile_games_spec.rb