add spec tests for sightstone and champion object

This commit is contained in:
danijoo
2014-03-23 14:49:06 +01:00
parent 5fa0f71418
commit 0bf7854f78
7 changed files with 77 additions and 17 deletions

13
spec/champion_spec.rb Normal file
View File

@@ -0,0 +1,13 @@
require 'spec_helper'
module Sightstone
describe Champion do
describe "#new" do
it "should initialize a champion object" do
c = Champion.new({active: true, attackRank: 1, botEnabled: true, botMmEnabled: true, defenseRank: 1,
freeToPlay: false, id: 1, magicRank: 1, name: "testName", rankedPlayEnabled: true})
c.should be_an_instance_of Champion
end
end
end
end

39
spec/sightstone_spec.rb Normal file
View File

@@ -0,0 +1,39 @@
require 'spec_helper'
module Sightstone
describe Sightstone do
before :each do
@sightstone = Sightstone.new("key", "region")
end
describe "#new" do
it "should initialize a sightstone object" do
@sightstone.should be_an_instance_of Sightstone
end
it "should initialize with the correct params" do
@sightstone.api_key.should eql "key"
@sightstone.region.should eql "region"
end
it "should initialize all modules" do
@sightstone.summoner.should be_an_instance_of SummonerModule
@sightstone.champion.should be_an_instance_of ChampionModule
@sightstone.game.should be_an_instance_of GameModule
@sightstone.league.should be_an_instance_of LeagueModule
@sightstone.stats.should be_an_instance_of StatsModule
@sightstone.ddragon.should be_an_instance_of DatadragonModule
@sightstone.team.should be_an_instance_of TeamModule
end
it "should initialize with a default region" do
s = Sightstone.new "my key"
s.region.should eql "euw"
end
end
end
end

7
spec/spec_helper.rb Normal file
View File

@@ -0,0 +1,7 @@
require 'rspec'
require 'sightstone'
RSpec.configure do |config|
config.color_enabled = true
config.formatter = 'documentation'
end