markify 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  university:
2
2
  acronym:
3
3
  login_name:
4
- password:
4
+ login_password:
5
5
 
6
6
  xmpp:
7
7
  bot_id:
@@ -44,7 +44,13 @@ class Markify::Scraper::Hbrs < Markify::Scraper::Base
44
44
  def scrape
45
45
  login_page = @agent.get(@data[:login_page])
46
46
 
47
- first_sis_page = sis_login(@data[:login_name], @data[:login_password], login_page)
47
+ begin
48
+ first_sis_page = sis_login(@data[:login_name], @data[:login_password], login_page)
49
+ rescue NoMethodError
50
+ puts "Error: SIS scraper error."
51
+ exit 0
52
+ end
53
+
48
54
  marks_table = get_marks_table(first_sis_page)
49
55
 
50
56
  get_marks(marks_table)
@@ -20,7 +20,7 @@ along with Markify. If not, see <http://www.gnu.org/licenses/>.
20
20
 
21
21
  module Markify
22
22
 
23
- VERSION = '0.2.0'
23
+ VERSION = '0.2.1'
24
24
  NAME = 'markify'
25
25
 
26
26
  DESCRIPTION =<<DESCRIPTION
@@ -37,12 +37,14 @@ HASHES
37
37
  @database.file_path.delete
38
38
  end
39
39
 
40
- it "should set default database path" do
41
- @database.file_path.should_not eq(nil)
42
- end
40
+ describe '#initialize' do
41
+ it "should set default database path" do
42
+ @database.file_path.should_not eq(nil)
43
+ end
43
44
 
44
- it "should set database path" do
45
- @database.file_path.should eq(Pathname('/tmp/markify_hashes.txt'))
45
+ it "should set database path" do
46
+ @database.file_path.should eq(Pathname('/tmp/markify_hashes.txt'))
47
+ end
46
48
  end
47
49
 
48
50
  describe "#check_for_new_marks" do
@@ -55,6 +57,14 @@ HASHES
55
57
  end
56
58
  end
57
59
 
60
+ describe "#write_checksum" do
61
+ it 'should write a checksum at the end of database file' do
62
+ @database.write_checksum('01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b')
63
+
64
+ File.readlines(@database.file_path).last.chomp.should eq '01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b'
65
+ end
66
+ end
67
+
58
68
  describe "#checksums" do
59
69
  it "should return all checksums in database" do
60
70
  @database.checksums.should eq(['19189e4668008cd48265538054282379c38bc7422811e4402a7f1e693138a579',
@@ -21,32 +21,34 @@ along with Markify. If not, see <http://www.gnu.org/licenses/>.
21
21
  require 'spec_helper'
22
22
 
23
23
  describe Markify::Mark do
24
- before do
24
+ before(:each) do
25
25
  @mark = Markify::Mark.new('Peter Lustig', '2342', '3.0', 'BE', '2', '23.02.1942')
26
26
  end
27
27
 
28
- it "should be a string" do
29
- @mark.name.should == "Peter Lustig"
30
- end
28
+ describe '#initialize' do
29
+ it "should be a string" do
30
+ @mark.name.should == "Peter Lustig"
31
+ end
31
32
 
32
- it "should be a integer" do
33
- @mark.id.should == 2342
34
- end
33
+ it "should be a integer" do
34
+ @mark.id.should == 2342
35
+ end
35
36
 
36
- it "should be a float" do
37
- @mark.mark.should == 3.0
38
- end
37
+ it "should be a float" do
38
+ @mark.mark.should == 3.0
39
+ end
39
40
 
40
- it "should be a string" do
41
- @mark.passed.should == "BE"
42
- end
41
+ it "should be a string" do
42
+ @mark.passed.should == "BE"
43
+ end
43
44
 
44
- it "should be a date" do
45
- @mark.date.should == Date.strptime("23.02.1942", '%d.%m.%Y')
46
- end
45
+ it "should be a date" do
46
+ @mark.date.should == Date.strptime("23.02.1942", '%d.%m.%Y')
47
+ end
47
48
 
48
- it "should be a integer" do
49
- @mark.try.should == 2
49
+ it "should be a integer" do
50
+ @mark.try.should == 2
51
+ end
50
52
  end
51
53
 
52
54
  describe "#to_s" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-01 00:00:00.000000000 Z
12
+ date: 2013-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xmpp4r
@@ -180,9 +180,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  - - ! '>='
181
181
  - !ruby/object:Gem::Version
182
182
  version: '0'
183
- segments:
184
- - 0
185
- hash: 3264874439132320863
186
183
  requirements: []
187
184
  rubyforge_project:
188
185
  rubygems_version: 1.8.23