kisaweb 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.md ADDED
@@ -0,0 +1,8 @@
1
+ == 0.0.2 / 2009-09-30
2
+ * Made Runner#club use the Club class
3
+
4
+ == 0.0.2 / 2009-09-30
5
+ * Added the Club class
6
+
7
+ == 0.0.1 / 2009-09-30
8
+ * First public release!
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
data/kisaweb.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{kisaweb}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jarkko Laine"]
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  ]
19
19
  s.files = [
20
20
  ".gitignore",
21
+ "History.md",
21
22
  "LICENSE",
22
23
  "README.markdown",
23
24
  "Rakefile",
data/lib/kisaweb/club.rb CHANGED
@@ -9,7 +9,7 @@ module Kisaweb
9
9
 
10
10
  def self.find(abbr)
11
11
  all.select do |club|
12
- club.abbreviation.downcase == abbr.downcase
12
+ club.abbreviation.to_s.downcase == abbr.downcase
13
13
  end.first
14
14
  end
15
15
 
@@ -1,9 +1,10 @@
1
1
  module Kisaweb
2
2
  class Runner
3
- attr_accessor :first_name, :last_name, :club, :license_number
3
+ attr_accessor :first_name, :last_name, :club_name, :license_number, :club
4
4
 
5
5
  def initialize(*args)
6
- self.last_name, self.first_name, self.club, self.license_number = *args
6
+ self.last_name, self.first_name, self.club_name, self.license_number = *args
7
+ self.club = Club.find(club_name)
7
8
  end
8
9
  end
9
10
  end
data/spec/club_spec.rb CHANGED
@@ -38,7 +38,7 @@ describe Kisaweb::Club do
38
38
  body = File.read(clubs_filename)
39
39
  resp = mock(:typhoeus_response, :body => body)
40
40
 
41
- Kisaweb::Club.should_receive(:fetch_all).
41
+ Kisaweb::Club.stub(:fetch_all).
42
42
  and_return(resp)
43
43
  @clubs = Kisaweb::Club.all
44
44
  end
@@ -1,6 +1,15 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
3
  describe Kisaweb::ListItem do
4
+ before(:all) do
5
+ clubs_filename = File.dirname(__FILE__) + "/fixtures/clubs.txt"
6
+ body = File.read(clubs_filename)
7
+ resp = mock(:typhoeus_response, :body => body)
8
+
9
+ Kisaweb::Club.stub(:fetch_all).
10
+ and_return(resp)
11
+ end
12
+
4
13
  context "from_array" do
5
14
  before(:each) do
6
15
  @arr = ["189", "Paavola", "Niko",
@@ -14,7 +23,7 @@ describe Kisaweb::ListItem do
14
23
  it "should create runner with correct details" do
15
24
  @item.runner.first_name.should == "Niko"
16
25
  @item.runner.last_name.should == "Paavola"
17
- @item.runner.club.should == "HimU"
26
+ @item.runner.club.abbreviation.should == "HimU"
18
27
  @item.runner.license_number.should == "1223"
19
28
  end
20
29
 
@@ -17,7 +17,7 @@ describe Kisaweb::OnlineRanki do
17
17
  before(:each) do
18
18
  body = "D16 255\nD18 166\nD20 151\nD21 745\nD35 200\nD40 233\nD45 215\nD50 168\nD55 171\nD60 140\nD65 74\nD70 38\nH16 279\nH18 213\nH20 172\nH21 1264\nH35 397\nH40 478\nH45 530\nH50 460\nH55 496\nH60 537\nH65 379\nH70 266\nH75 135\nH80 45\nD75 16\nH85 8\n"
19
19
  resp = stub(:typhoeus_response, :body => body)
20
- Kisaweb::OnlineRanki.should_receive(:fetch_categories).
20
+ Kisaweb::OnlineRanki.stub(:fetch_categories).
21
21
  and_return(resp)
22
22
  @cats = Kisaweb::OnlineRanki.categories
23
23
  end
data/spec/runner_spec.rb CHANGED
@@ -3,12 +3,20 @@ require File.dirname(__FILE__) + '/spec_helper'
3
3
  describe Kisaweb::Runner do
4
4
  context "new" do
5
5
  before(:each) do
6
- @runner = Kisaweb::Runner.new("last", "first", "club", "12345")
6
+ clubs_filename = File.dirname(__FILE__) + "/fixtures/clubs.txt"
7
+ body = File.read(clubs_filename)
8
+ resp = mock(:typhoeus_response, :body => body)
9
+
10
+ Kisaweb::Club.stub(:fetch_all).
11
+ and_return(resp)
12
+ @runner = Kisaweb::Runner.new("last", "first", "IkNV", "12345")
7
13
  end
8
14
 
9
15
  it "should set the attributes correctly" do
10
16
  @runner.first_name.should == "first"
11
17
  @runner.last_name.should == "last"
18
+
19
+ @runner.club.name.should == "Ikaalisten Nouseva-Voima"
12
20
  end
13
21
  end
14
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kisaweb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarkko Laine
@@ -43,6 +43,7 @@ extra_rdoc_files:
43
43
  - README.markdown
44
44
  files:
45
45
  - .gitignore
46
+ - History.md
46
47
  - LICENSE
47
48
  - README.markdown
48
49
  - Rakefile