Skip to content

Commit

Permalink
all attributes of league but entries have been implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
intinig committed Dec 12, 2013
1 parent e3ed4ee commit 010a101
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
34 changes: 33 additions & 1 deletion lib/lol/league.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
module Lol
class League
# Holds the representation of a League
class League < Model
# @!attribute [r] raw
# @return [String] raw version of options Hash used to initialize League
attr_reader :raw

# @!attribute [r] timestamp
# @return [String] timestamp of league snapshot
attr_reader :timestamp

# @!attribute [r] name
# @return [String] name of league
attr_reader :name

# @!attribute [r] tier
# @return [String] tier of league
attr_reader :tier

# @!attribute [r] queue
# @return [String] type of queue
attr_reader :queue

# @!attribute [r] entries
# @return [String] summoners / teams in queue
attr_reader :entries

private

attr_writer :timestamp, :name, :tier, :queue

def entries= list
"foo"
end
end
end
2 changes: 1 addition & 1 deletion spec/lol/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
end

it "returns an array of Leagues" do
expect(subject).to be_a(Array)
expect(subject.map(&:class).uniq).to eq([League])
end
end
end
25 changes: 25 additions & 0 deletions spec/lol/league_spec.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
require "spec_helper"
require "lol"

include Lol

describe League do
it "inherits from Lol::Model" do
expect(League.ancestors[1]).to eq(Model)
end

context "initialization" do
it_behaves_like 'Lol model' do
let(:valid_attributes) { { timestamp: 123456 } }
end

%w(timestamp name tier queue).each do |attribute|
describe "#{attribute} attribute" do
it_behaves_like 'plain attribute' do
let(:attribute) { attribute }
let(:attribute_value) { 'asd' }
end
end
end

pending "fills entries with LeagueEntry objects"
end
end

0 comments on commit 010a101

Please sign in to comment.