better champ init for test and other stuff

This commit is contained in:
danijoo
2014-03-23 16:18:14 +01:00
parent b17ac7e0bd
commit 5bb4770e3c
2 changed files with 64 additions and 3 deletions

40
spec/ranked_stats_spec.rb Normal file
View File

@@ -0,0 +1,40 @@
require 'spec_helper'
module Sightstone
describe RankedStats do
before :each do
stats = [{"id" => 1, "stats"=> {"Stat1" => 1, "Stat2" => 2}}, {"id" => 2, "stats"=> {"Stat1" => 1, "Stat2" => 2}}]
@rs = RankedStats.new({"summonerId" => 1, "modifyDate" => 1, "champions" => stats })
end
it "should have a summoner id" do
@rs.summonerId.should eql 1
end
it "should have a modification date" do
@rs.modifyDate.should eql 1
end
it "should have an array of champion stats" do
@rs.champions.should be_an_instance_of Hash
@rs.champions.should have(2).items
@rs.champions.each do |key, hash|
key.should be_a_kind_of Fixnum
hash.should be_an_instance_of Hash
hash.each do |stat, value|
stat.should be_an_instance_of String
value.should be_a_kind_of Fixnum
end
end
end
describe "#new" do
it "should create a ranked stats obejct" do
@rs.should be_an_instance_of RankedStats
end
end
end
end