markify 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/examples/config.yml.example +1 -1
- data/lib/markify/scraper/hbrs.rb +7 -1
- data/lib/markify/version.rb +1 -1
- data/spec/markify/database_spec.rb +15 -5
- data/spec/markify/mark_spec.rb +20 -18
- metadata +2 -5
data/examples/config.yml.example
CHANGED
data/lib/markify/scraper/hbrs.rb
CHANGED
@@ -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
|
-
|
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)
|
data/lib/markify/version.rb
CHANGED
@@ -37,12 +37,14 @@ HASHES
|
|
37
37
|
@database.file_path.delete
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
-
|
45
|
-
|
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',
|
data/spec/markify/mark_spec.rb
CHANGED
@@ -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
|
-
|
29
|
-
|
30
|
-
|
28
|
+
describe '#initialize' do
|
29
|
+
it "should be a string" do
|
30
|
+
@mark.name.should == "Peter Lustig"
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
it "should be a integer" do
|
34
|
+
@mark.id.should == 2342
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
it "should be a float" do
|
38
|
+
@mark.mark.should == 3.0
|
39
|
+
end
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
it "should be a string" do
|
42
|
+
@mark.passed.should == "BE"
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
it "should be a date" do
|
46
|
+
@mark.date.should == Date.strptime("23.02.1942", '%d.%m.%Y')
|
47
|
+
end
|
47
48
|
|
48
|
-
|
49
|
-
|
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.
|
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-
|
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
|