Skip to content

Commit

Permalink
completed call to Client#champion
Browse files Browse the repository at this point in the history
  • Loading branch information
intinig committed Dec 11, 2013
1 parent 7d299d3 commit f15f6c7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
11 changes: 11 additions & 0 deletions lib/lol/champion.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
module Lol
class Champion

# Initializes a Lol::Champion
# @param options [Hash]
# @return [Lol::Champion]
def initialize options = {}
@raw = options
end

def raw
@raw
end
end
end
2 changes: 1 addition & 1 deletion lib/lol/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def champion
# Returns a list of all champions, v1.1
# @return [Array] an array of champions
def champion11
[Champion.new]
self.class.get(api_url("v1.1", "champion"))["champions"].map {|c| Champion.new(c)}
end

# Initializes a Lol::Client
Expand Down
12 changes: 12 additions & 0 deletions spec/lol/champion_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require "lol"
require "spec_helper"

include Lol

describe Champion do
describe "#new" do
it "takes an option hash as argument" do
expect { Champion.new({ :foo => :bar }) }.not_to raise_error
end
end
end
4 changes: 2 additions & 2 deletions spec/lol/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
let(:client) { Client.new "foo" }

subject do
expect(client).to receive(:get).with(client.api_url("v1.1", "champion")).and_return(load_fixture("champion", "v1.1", "get"))
expect(Client).to receive(:get).with(client.api_url("v1.1", "champion")).and_return(load_fixture("champion", "v1.1", "get"))

client.champion11
end
Expand All @@ -46,7 +46,7 @@
end

it "fetches champions from the API" do
expect(subject.size).to eq(108)
expect(subject.size).to eq(load_fixture("champion", "v1.1", "get")["champions"].size)
end
end

Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require "rubygems"
require "rspec"
require "simplecov"
require "coveralls"
Expand Down

0 comments on commit f15f6c7

Please sign in to comment.