From 64b301543ba584bf4d3474f44173987dfd104fc7 Mon Sep 17 00:00:00 2001 From: danijoo Date: Mon, 24 Mar 2014 16:31:43 +0100 Subject: [PATCH] rspec for runes, maasteries and history games --- lib/sightstone/match_history.rb | 4 +- spec/masterybook_spec.rb | 70 ++++++++++++++++++++++++++ spec/match_history_spec.rb | 88 +++++++++++++++++++++++++++++++++ spec/runebook_spec.rb | 71 ++++++++++++++++++++++++++ 4 files changed, 231 insertions(+), 2 deletions(-) create mode 100644 spec/masterybook_spec.rb create mode 100644 spec/match_history_spec.rb create mode 100644 spec/runebook_spec.rb diff --git a/lib/sightstone/match_history.rb b/lib/sightstone/match_history.rb index f32c09b..a0c5321 100644 --- a/lib/sightstone/match_history.rb +++ b/lib/sightstone/match_history.rb @@ -26,7 +26,7 @@ end # @attr [Fixnum] mapId ID of the played map # @attr [Fixnum] spell1 selected summoner spell no 1 # @attr [Fixnum] spell2 selected summoner spell no 2 -# @attr [String] subtype subtype +# @attr [String] subType subtype # @attr [Fixnum] teamId ID of the team if there is a team associated to the game # @attr [Hash] statistics statistics of the game as a Hash: name -> value class HistoryGame @@ -62,7 +62,7 @@ end # player of a game # @attr [Fixnum] championId ID of played Champion # @attr [Fixnum] summonerId ID of the summoner -# @attr [Fixnum] teammId ID of the team +# @attr [Fixnum] teamId ID of the team class Player attr_accessor :championId, :summonerId, :teamId diff --git a/spec/masterybook_spec.rb b/spec/masterybook_spec.rb new file mode 100644 index 0000000..f236502 --- /dev/null +++ b/spec/masterybook_spec.rb @@ -0,0 +1,70 @@ +require 'spec_helper' +require 'json' + +module Sightstone + + describe MasteryBook do + + before :all do + json_mockup = JSON.parse('{"pages": [{"id": 34106888,"talents": [{"id": 4211,"rank": 2,"name": "Block"},{"id": 4353,"rank": 3,"name": "Intelligence"},{"id": 4362,"rank": 1,"name": "Wanderer"},{"id": 4213,"rank": 2,"name": "Enchanted Armor"},{"id": 4322,"rank": 3,"name": "Summoners Insight"},{"id": 4334,"rank": 1,"name": "Culinary Master"},{"id": 4344,"rank": 2,"name": "Inspiration"},{"id": 4352,"rank": 1,"name": "Bandit"},{"id": 4222,"rank": 3,"name": "Veterans Scars"},{"id": 4314,"rank": 1,"name": "Scout"},{"id": 4221,"rank": 1,"name": "Unyielding"},{"id": 4331,"rank": 3,"name": "Greed"},{"id": 4324,"rank": 1,"name": "Alchemist"},{"id": 4312,"rank": 3,"name": "Fleet of Foot"},{"id": 4232,"rank": 1,"name": "Juggernaut"},{"id": 4342,"rank": 1,"name": "Wealth"},{"id": 4341,"rank": 1,"name": "Scavenger"}],"name": "gammel supp","current": false},{"id": 34106889,"talents": [{"id": 4311,"rank": 1,"name": "Phasewalker"},{"id": 4353,"rank": 3,"name": "Intelligence"},{"id": 4121,"rank": 1,"name": "Expose Weakness"},{"id": 4362,"rank": 1,"name": "Wanderer"},{"id": 4312,"rank": 2,"name": "Fleet of Foot"},{"id": 4322,"rank": 3,"name": "Summoners Insight"},{"id": 4334,"rank": 1,"name": "Culinary Master"},{"id": 4344,"rank": 2,"name": "Inspiration"},{"id": 4352,"rank": 1,"name": "Bandit"},{"id": 4113,"rank": 4,"name": "Sorcery"},{"id": 4314,"rank": 1,"name": "Scout"},{"id": 4331,"rank": 3,"name": "Greed"},{"id": 4324,"rank": 1,"name": "Alchemist"},{"id": 4123,"rank": 3,"name": "Mental Force"},{"id": 4133,"rank": 1,"name": "Arcane Mastery"},{"id": 4342,"rank": 1,"name": "Wealth"},{"id": 4341,"rank": 1,"name": "Scavenger"}],"name": "pew pew ks supp","current": false},{"id": 34106890,"talents": [{"id": 4211,"rank": 2,"name": "Block"},{"id": 4213,"rank": 2,"name": "Enchanted Armor"},{"id": 4124,"rank": 1,"name": "Feast"},{"id": 4154,"rank": 1,"name": "Arcane Blade"},{"id": 4114,"rank": 1,"name": "Butcher"},{"id": 4222,"rank": 3,"name": "Veterans Scars"},{"id": 4113,"rank": 4,"name": "Sorcery"},{"id": 4221,"rank": 1,"name": "Unyielding"},{"id": 4152,"rank": 3,"name": "Devastating Strikes"},{"id": 4123,"rank": 3,"name": "Mental Force"},{"id": 4111,"rank": 1,"name": "Double-Edged Sword"},{"id": 4134,"rank": 2,"name": "Executioner"},{"id": 4133,"rank": 1,"name": "Arcane Mastery"},{"id": 4232,"rank": 1,"name": "Juggernaut"},{"id": 4143,"rank": 3,"name": "Archmage"},{"id": 4162,"rank": 1,"name": "Havoc"}],"name": "APC resi","current": false},{"id": 34106891,"talents": [{"id": 4212,"rank": 2,"name": "Recovery"},{"id": 4211,"rank": 2,"name": "Block"},{"id": 4124,"rank": 1,"name": "Feast"},{"id": 4154,"rank": 1,"name": "Arcane Blade"},{"id": 4114,"rank": 1,"name": "Butcher"},{"id": 4222,"rank": 3,"name": "Veterans Scars"},{"id": 4113,"rank": 4,"name": "Sorcery"},{"id": 4221,"rank": 1,"name": "Unyielding"},{"id": 4152,"rank": 3,"name": "Devastating Strikes"},{"id": 4123,"rank": 3,"name": "Mental Force"},{"id": 4111,"rank": 1,"name": "Double-Edged Sword"},{"id": 4134,"rank": 2,"name": "Executioner"},{"id": 4133,"rank": 1,"name": "Arcane Mastery"},{"id": 4232,"rank": 1,"name": "Juggernaut"},{"id": 4143,"rank": 3,"name": "Archmage"},{"id": 4162,"rank": 1,"name": "Havoc"}],"name": "APC std","current": false},{"id": 34106892,"talents": [{"id": 4242,"rank": 1,"name": "Swiftness"},{"id": 4212,"rank": 2,"name": "Recovery"},{"id": 4211,"rank": 2,"name": "Block"},{"id": 4214,"rank": 2,"name": "Tough Skin"},{"id": 4213,"rank": 2,"name": "Enchanted Armor"},{"id": 4124,"rank": 1,"name": "Feast"},{"id": 4251,"rank": 1,"name": "Second Wind"},{"id": 4114,"rank": 1,"name": "Butcher"},{"id": 4222,"rank": 3,"name": "Veterans Scars"},{"id": 4221,"rank": 1,"name": "Unyielding"},{"id": 4122,"rank": 3,"name": "Brute Force"},{"id": 4112,"rank": 2,"name": "Fury"},{"id": 4262,"rank": 1,"name": "Tenacious"},{"id": 4224,"rank": 1,"name": "Bladed Armor"},{"id": 4111,"rank": 1,"name": "Double-Edged Sword"},{"id": 4132,"rank": 1,"name": "Martial Mastery"},{"id": 4241,"rank": 3,"name": "Perseverance"},{"id": 4233,"rank": 1,"name": "Hardiness"},{"id": 4232,"rank": 1,"name": "Juggernaut"}],"name": "Deff AD Jungle","current": false},{"id": 34106893,"talents": [{"id": 4212,"rank": 2,"name": "Recovery"},{"id": 4242,"rank": 1,"name": "Swiftness"},{"id": 4311,"rank": 1,"name": "Phasewalker"},{"id": 4211,"rank": 2,"name": "Block"},{"id": 4214,"rank": 2,"name": "Tough Skin"},{"id": 4213,"rank": 2,"name": "Enchanted Armor"},{"id": 4322,"rank": 3,"name": "Summoners Insight"},{"id": 4332,"rank": 1,"name": "Runic Affinity"},{"id": 4251,"rank": 1,"name": "Second Wind"},{"id": 4222,"rank": 3,"name": "Veterans Scars"},{"id": 4314,"rank": 1,"name": "Scout"},{"id": 4221,"rank": 1,"name": "Unyielding"},{"id": 4262,"rank": 1,"name": "Tenacious"},{"id": 4224,"rank": 1,"name": "Bladed Armor"},{"id": 4231,"rank": 1,"name": "Oppression"},{"id": 4312,"rank": 3,"name": "Fleet of Foot"},{"id": 4241,"rank": 3,"name": "Perseverance"},{"id": 4232,"rank": 1,"name": "Juggernaut"}],"name": "tank/utility","current": false},{"id": 34106894,"talents": [{"id": 4212,"rank": 2,"name": "Recovery"},{"id": 4214,"rank": 2,"name": "Tough Skin"},{"id": 4134,"rank": 3,"name": "Executioner"},{"id": 4124,"rank": 1,"name": "Feast"},{"id": 4154,"rank": 1,"name": "Arcane Blade"},{"id": 4114,"rank": 1,"name": "Butcher"},{"id": 4113,"rank": 4,"name": "Sorcery"},{"id": 4152,"rank": 3,"name": "Devastating Strikes"},{"id": 4123,"rank": 3,"name": "Mental Force"},{"id": 4224,"rank": 1,"name": "Bladed Armor"},{"id": 4312,"rank": 3,"name": "Fleet of Foot"},{"id": 4111,"rank": 1,"name": "Double-Edged Sword"},{"id": 4133,"rank": 1,"name": "Arcane Mastery"},{"id": 4143,"rank": 3,"name": "Archmage"},{"id": 4162,"rank": 1,"name": "Havoc"}],"name": "ap jungle","current": false},{"id": 34106895,"talents": [{"id": 4211,"rank": 2,"name": "Block"},{"id": 4134,"rank": 3,"name": "Executioner"},{"id": 4322,"rank": 3,"name": "Summoners Insight"},{"id": 4124,"rank": 1,"name": "Feast"},{"id": 4114,"rank": 1,"name": "Butcher"},{"id": 4112,"rank": 4,"name": "Fury"},{"id": 4314,"rank": 1,"name": "Scout"},{"id": 4122,"rank": 3,"name": "Brute Force"},{"id": 4152,"rank": 3,"name": "Devastating Strikes"},{"id": 4312,"rank": 3,"name": "Fleet of Foot"},{"id": 4111,"rank": 1,"name": "Double-Edged Sword"},{"id": 4132,"rank": 1,"name": "Martial Mastery"},{"id": 4142,"rank": 3,"name": "Warlord"},{"id": 4162,"rank": 1,"name": "Havoc"}],"name": "adc","current": false},{"id": 34106896,"talents": [{"id": 4233,"rank": 3,"name": "Hardiness"},{"id": 4211,"rank": 2,"name": "Block"},{"id": 4243,"rank": 1,"name": "Reinforced Armor"},{"id": 4213,"rank": 2,"name": "Enchanted Armor"},{"id": 4322,"rank": 3,"name": "Summoners Insight"},{"id": 4244,"rank": 1,"name": "Evasive"},{"id": 4234,"rank": 3,"name": "Resistance"},{"id": 4222,"rank": 3,"name": "Veterans Scars"},{"id": 4314,"rank": 1,"name": "Scout"},{"id": 4221,"rank": 1,"name": "Unyielding"},{"id": 4324,"rank": 1,"name": "Alchemist"},{"id": 4252,"rank": 4,"name": "Legendary Guardian"},{"id": 4262,"rank": 1,"name": "Tenacious"},{"id": 4312,"rank": 3,"name": "Fleet of Foot"},{"id": 4232,"rank": 1,"name": "Juggernaut"}],"name": "outrageous tank supp","current": false},{"id": 34106897,"talents": [{"id": 4212,"rank": 2,"name": "Recovery"},{"id": 4214,"rank": 2,"name": "Tough Skin"},{"id": 4134,"rank": 3,"name": "Executioner"},{"id": 4222,"rank": 3,"name": "Veterans Scars"},{"id": 4113,"rank": 4,"name": "Sorcery"},{"id": 4144,"rank": 1,"name": "Dangerous Game"},{"id": 4122,"rank": 3,"name": "Brute Force"},{"id": 4152,"rank": 3,"name": "Devastating Strikes"},{"id": 4141,"rank": 1,"name": "Blade Weaving"},{"id": 4224,"rank": 1,"name": "Bladed Armor"},{"id": 4132,"rank": 1,"name": "Martial Mastery"},{"id": 4232,"rank": 1,"name": "Juggernaut"},{"id": 4162,"rank": 1,"name": "Havoc"},{"id": 4112,"rank": 3,"name": "Fury"},{"id": 4131,"rank": 1,"name": "Spell Weaving"}],"name": "noc noc?","current": true},{"id": 34106898,"talents": [{"id": 4214,"rank": 2,"name": "Tough Skin"},{"id": 4213,"rank": 2,"name": "Enchanted Armor"},{"id": 4334,"rank": 1,"name": "Culinary Master"},{"id": 4322,"rank": 3,"name": "Summoners Insight"},{"id": 4332,"rank": 1,"name": "Runic Affinity"},{"id": 4124,"rank": 1,"name": "Feast"},{"id": 4323,"rank": 1,"name": "Strength of Spirit"},{"id": 4114,"rank": 1,"name": "Butcher"},{"id": 4222,"rank": 3,"name": "Veterans Scars"},{"id": 4314,"rank": 1,"name": "Scout"},{"id": 4324,"rank": 1,"name": "Alchemist"},{"id": 4122,"rank": 3,"name": "Brute Force"},{"id": 4224,"rank": 1,"name": "Bladed Armor"},{"id": 4313,"rank": 3,"name": "Meditation"},{"id": 4111,"rank": 1,"name": "Double-Edged Sword"},{"id": 4132,"rank": 1,"name": "Martial Mastery"},{"id": 4232,"rank": 1,"name": "Juggernaut"},{"id": 4113,"rank": 3,"name": "Sorcery"}],"name": "ww jungle","current": false},{"id": 34106899,"talents": [{"id": 4211,"rank": 2,"name": "Block"},{"id": 4214,"rank": 2,"name": "Tough Skin"},{"id": 4134,"rank": 3,"name": "Executioner"},{"id": 4114,"rank": 1,"name": "Butcher"},{"id": 4222,"rank": 3,"name": "Veterans Scars"},{"id": 4221,"rank": 1,"name": "Unyielding"},{"id": 4144,"rank": 1,"name": "Dangerous Game"},{"id": 4122,"rank": 3,"name": "Brute Force"},{"id": 4152,"rank": 3,"name": "Devastating Strikes"},{"id": 4141,"rank": 1,"name": "Blade Weaving"},{"id": 4111,"rank": 1,"name": "Double-Edged Sword"},{"id": 4132,"rank": 1,"name": "Martial Mastery"},{"id": 4232,"rank": 1,"name": "Juggernaut"},{"id": 4162,"rank": 1,"name": "Havoc"},{"id": 4112,"rank": 3,"name": "Fury"},{"id": 4142,"rank": 2,"name": "Warlord"},{"id": 4131,"rank": 1,"name": "Spell Weaving"}],"name": "vi","current": false},{"id": 34106900,"current": false}],"summonerId": 30447079}') + @book = MasteryBook.new(json_mockup) + end + + describe "#new" do + it "should initialize a mastery book object" do + @book.should be_an_instance_of MasteryBook + end + + it "should initialize with correct params" do + @book.pages.should be_instance_of Array + @book.pages.each do |page| + page.should be_instance_of MasteryPage + end + @book.summonerId.should be_instance_of Fixnum + end + end + + end + + describe MasteryPage do + before :all do + json_mockup = JSON.parse('{"id": 34106888,"talents": [{"id": 4211,"rank": 2,"name": "Block"},{"id": 4353,"rank": 3,"name": "Intelligence"},{"id": 4362,"rank": 1,"name": "Wanderer"},{"id": 4213,"rank": 2,"name": "Enchanted Armor"},{"id": 4322,"rank": 3,"name": "Summoners Insight"},{"id": 4334,"rank": 1,"name": "Culinary Master"}],"name": "vi","current": false}') + @page = MasteryPage.new(json_mockup) + end + + describe "#new" do + it "should initilalize a mastery page" do + @page.should be_instance_of MasteryPage + end + + it "should initilalize with correct params" do + @page.id.should be_instance_of Fixnum + @page.name.should be_instance_of String + @page.talents.should be_instance_of Array + @page.talents.each do |talent| + talent.should be_instance_of Talent + end + end + end + end + + describe Talent do + before :all do + json_mockup = JSON.parse('{"id": 4142,"rank": 2,"name": "Warlord"}') + @talent = Talent.new(json_mockup) + end + + describe "#new" do + it "should init a talent" do + @talent.should be_instance_of Talent + end + + it "should init with correct params" do + @talent.id.should be_instance_of Fixnum + @talent.rank.should be_instance_of Fixnum + @talent.name.should be_instance_of String + end + end + end + +end \ No newline at end of file diff --git a/spec/match_history_spec.rb b/spec/match_history_spec.rb new file mode 100644 index 0000000..25c609c --- /dev/null +++ b/spec/match_history_spec.rb @@ -0,0 +1,88 @@ +require 'spec_helper' +require 'json' + +module Sightstone + + describe MatchHistory do + + before :all do + json_mockup = JSON.parse('{"games":[{"gameType": "MATCHED_GAME","fellowPlayers": [{"championId": 102,"teamId": 100,"summonerId": 19440603},{"championId": 51,"teamId": 200,"summonerId": 26261198},{"championId": 79,"teamId": 100,"summonerId": 22151489},{"championId": 13,"teamId": 200,"summonerId": 23429462},{"championId": 106,"teamId": 200,"summonerId": 30818765},{"championId": 48,"teamId": 200,"summonerId": 25932666},{"championId": 24,"teamId": 100,"summonerId": 22906613},{"championId": 89,"teamId": 200,"summonerId": 33288326},{"championId": 16,"teamId": 100,"summonerId": 238666}],"stats": {"totalDamageDealtToChampions": 26806,"item2": 3252,"goldEarned": 12738,"item1": 3031,"wardPlaced": 9,"totalDamageTaken": 25573,"item0": 1055,"trueDamageDealtPlayer": 10713,"physicalDamageDealtPlayer": 129104,"trueDamageDealtToChampions": 5597,"killingSprees": 2,"totalUnitsHealed": 1,"largestCriticalStrike": 696,"level": 16,"doubleKills": 1,"neutralMinionsKilledYourJungle": 8,"neutralMinionsKilledEnemyJungle": 7,"assists": 5,"magicDamageTaken": 9216,"numDeaths": 9,"totalTimeCrowdControlDealt": 604,"largestMultiKill": 2,"physicalDamageTaken": 15714,"sightWardsBought": 2,"win": false,"team": 100,"totalDamageDealt": 139818,"largestKillingSpree": 4,"totalHeal": 1004,"item4": 3072,"item3": 3046,"item6": 3340,"minionsKilled": 171,"timePlayed": 2124,"physicalDamageDealtToChampions": 21208,"championsKilled": 10,"trueDamageTaken": 642,"goldSpent": 14620,"neutralMinionsKilled": 15},"gameId": 1390514911,"spell1": 4,"teamId": 100,"spell2": 21,"gameMode": "CLASSIC","mapId": 1,"level": 30,"invalid": false,"subType": "RANKED_SOLO_5x5","championId": 29,"createDate": 1395672014277}], "summonerId": 12345}') + @mh = MatchHistory.new(json_mockup) + end + + describe "#new" do + + it "should init a match hisotry object" do + @mh.should be_instance_of MatchHistory + end + + it "should init with correct params" do + @mh.summonerId.should be_instance_of Fixnum + @mh.games.should be_instance_of Array + @mh.games.each do |game| + game.should be_instance_of HistoryGame + end + end + end + end + + describe HistoryGame do + before :all do + json_mockup = JSON.parse('{"gameType": "MATCHED_GAME","fellowPlayers": [{"championId": 102,"teamId": 100,"summonerId": 19440603},{"championId": 51,"teamId": 200,"summonerId": 26261198},{"championId": 79,"teamId": 100,"summonerId": 22151489},{"championId": 13,"teamId": 200,"summonerId": 23429462},{"championId": 106,"teamId": 200,"summonerId": 30818765},{"championId": 48,"teamId": 200,"summonerId": 25932666},{"championId": 24,"teamId": 100,"summonerId": 22906613},{"championId": 89,"teamId": 200,"summonerId": 33288326},{"championId": 16,"teamId": 100,"summonerId": 238666}],"stats": {"totalDamageDealtToChampions": 26806,"item2": 3252,"goldEarned": 12738,"item1": 3031,"wardPlaced": 9,"totalDamageTaken": 25573,"item0": 1055,"trueDamageDealtPlayer": 10713,"physicalDamageDealtPlayer": 129104,"trueDamageDealtToChampions": 5597,"killingSprees": 2,"totalUnitsHealed": 1,"largestCriticalStrike": 696,"level": 16,"doubleKills": 1,"neutralMinionsKilledYourJungle": 8,"neutralMinionsKilledEnemyJungle": 7,"assists": 5,"magicDamageTaken": 9216,"numDeaths": 9,"totalTimeCrowdControlDealt": 604,"largestMultiKill": 2,"physicalDamageTaken": 15714,"sightWardsBought": 2,"win": false,"team": 100,"totalDamageDealt": 139818,"largestKillingSpree": 4,"totalHeal": 1004,"item4": 3072,"item3": 3046,"item6": 3340,"minionsKilled": 171,"timePlayed": 2124,"physicalDamageDealtToChampions": 21208,"championsKilled": 10,"trueDamageTaken": 642,"goldSpent": 14620,"neutralMinionsKilled": 15},"gameId": 1390514911,"spell1": 4,"teamId": 100,"spell2": 21,"gameMode": "CLASSIC","mapId": 1,"level": 30,"invalid": false,"subType": "RANKED_SOLO_5x5","championId": 29,"createDate": 1395672014277}') + @hg = HistoryGame.new(json_mockup) + end + + describe "#new" do + it "should init a history game" do + @hg.should be_instance_of HistoryGame + end + + it "should init with correct params" do + @hg.championId.should be_instance_of Fixnum + @hg.createDate.should be_instance_of Fixnum + @hg.fellowPlayers.should be_instance_of Array + @hg.fellowPlayers.each do |p| + p.should be_instance_of Player + end + @hg.gameId.should be_instance_of Fixnum + @hg.gameMode.should be_instance_of String + @hg.gameType.should be_instance_of String + @hg.invalid.should satisfy {|s| [true, false].include? s} + @hg.level.should be_instance_of Fixnum + @hg.mapId.should be_instance_of Fixnum + @hg.spell1.should be_instance_of Fixnum + @hg.spell2.should be_instance_of Fixnum + @hg.statistics.should be_instance_of Hash + @hg.statistics.each do |key, stat| + key.should be_instance_of String + stat.should satisfy {|s| ([true, false].include?(s) or s.is_a?(Fixnum))} + end + @hg.subType.should be_instance_of String + @hg.teamId.should be_instance_of Fixnum + end + end + end + + describe Player do + before :all do + mockup_json = JSON.parse('{"championId": 79,"teamId": 100,"summonerId": 22151489}') + @player = Player.new(mockup_json) + end + + describe "#new" do + + it "should init a player" do + @player.should be_instance_of Player + end + + it "should init with correct params" do + @player.championId.should be_instance_of Fixnum + @player.summonerId.should be_instance_of Fixnum + @player.teamId.should be_instance_of Fixnum + end + + end + end + + +end \ No newline at end of file diff --git a/spec/runebook_spec.rb b/spec/runebook_spec.rb new file mode 100644 index 0000000..ca27364 --- /dev/null +++ b/spec/runebook_spec.rb @@ -0,0 +1,71 @@ +require 'spec_helper' +require 'json' + +module Sightstone + + describe RuneBook do + + before :all do + json_mockup = JSON.parse('{"pages":[{"id": 27005798,"slots": [{"runeSlotId": 1,"rune": {"id": 5273,"description": "+0.87 magic penetration","name": "Greater Mark of Magic Penetration","tier": 3}},{"runeSlotId": 2,"rune": {"id": 5273,"description": "+0.87 magic penetration","name": "Greater Mark of Magic Penetration","tier": 3}},{"runeSlotId": 3,"rune": {"id": 5273,"description": "+0.87 magic penetration","name": "Greater Mark of Magic Penetration","tier": 3}}],"name": "fulltank ap","current": false}], "summonerId":12345}') + @book = RuneBook.new(json_mockup) + end + + describe "#new" do + it "should initialize a rune book object" do + @book.should be_an_instance_of RuneBook + end + + it "should initialize with correct params" do + @book.pages.should be_instance_of Array + @book.pages.each do |page| + page.should be_instance_of RunePage + end + @book.summonerId.should be_instance_of Fixnum + end + end + + end + + describe RunePage do + before :all do + json_mockup = JSON.parse('{"id": 27005798,"slots": [{"runeSlotId": 1,"rune": {"id": 5273,"description": "+0.87 magic penetration","name": "Greater Mark of Magic Penetration","tier": 3}},{"runeSlotId": 2,"rune": {"id": 5273,"description": "+0.87 magic penetration","name": "Greater Mark of Magic Penetration","tier": 3}},{"runeSlotId": 3,"rune": {"id": 5273,"description": "+0.87 magic penetration","name": "Greater Mark of Magic Penetration","tier": 3}}],"name": "fulltank ap","current": false}') + @page = RunePage.new(json_mockup) + end + + describe "#new" do + it "should initilalize a rune page" do + @page.should be_instance_of RunePage + end + + it "should initilalize with correct params" do + @page.id.should be_instance_of Fixnum + @page.name.should be_instance_of String + @page.slots.should be_instance_of Hash + @page.slots.each do |key,slot| + slot.should be_instance_of Rune + end + end + end + end + + describe Rune do + before :all do + json_mockup = JSON.parse('{"id": 5273,"description": "+0.87 magic penetration","name": "Greater Mark of Magic Penetration","tier": 3}') + @rune = Rune.new(json_mockup) + end + + describe "#new" do + it "should init a talent" do + @rune.should be_instance_of Rune + end + + it "should init with correct params" do + @rune.description.should be_instance_of String + @rune.id.should be_instance_of Fixnum + @rune.name.should be_instance_of String + @rune.tier.should be_instance_of Fixnum + end + end + end + +end \ No newline at end of file