mirror of https://github.com/captn3m0/muse-dl.git
Adds tests for page detection
This commit is contained in:
parent
919c8ac43f
commit
38db0dd000
|
@ -57,5 +57,29 @@ describe Muse::Dl::Issue do
|
||||||
issue.info["Open Access"].should eq "Yes"
|
issue.info["Open Access"].should eq "Yes"
|
||||||
issue.title.should eq "Volume 1, Issue 2, 2016"
|
issue.title.should eq "Volume 1, Issue 2, 2016"
|
||||||
issue.journal_title.should eq "Constitutional Studies"
|
issue.journal_title.should eq "Constitutional Studies"
|
||||||
|
|
||||||
|
expected_pages = [
|
||||||
|
[1, 22],
|
||||||
|
[23, 40],
|
||||||
|
[41, 58],
|
||||||
|
[59, 80],
|
||||||
|
[81, 95],
|
||||||
|
[97, 116],
|
||||||
|
]
|
||||||
|
|
||||||
|
expected_titles = [
|
||||||
|
"The Limits of Veneration: Public Support for a New Constitutional Convention",
|
||||||
|
"Secession and Nullification as a Global Trend",
|
||||||
|
"Challenging Constitutionalism in Post-Apartheid South Africa",
|
||||||
|
"Democracy by Lawsuit: Or, Can Litigation Alleviate the European Union’s “Democratic Deficit?”",
|
||||||
|
"Private Enforcement of Constitutional Guarantees in the Ku Klux Act of 1871",
|
||||||
|
"Sober Second Thoughts: Evaluating the History of Horizontal Judicial Review by the U.S. Supreme Court",
|
||||||
|
]
|
||||||
|
|
||||||
|
issue.articles.each_with_index do |a, i|
|
||||||
|
a.start_page.should eq expected_pages[i][0]
|
||||||
|
a.end_page.should eq expected_pages[i][1]
|
||||||
|
a.title.should eq expected_titles[i]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ require "./issue.cr"
|
||||||
|
|
||||||
module Muse::Dl
|
module Muse::Dl
|
||||||
class Article
|
class Article
|
||||||
getter id : String
|
getter id : String, :start_page, :end_page, :title
|
||||||
setter title : String | Nil, start_page : Int32 | Nil, end_page : Int32 | Nil
|
setter title : String | Nil, start_page : Int32 | Nil, end_page : Int32 | Nil
|
||||||
|
|
||||||
def initialize(id : String)
|
def initialize(id : String)
|
||||||
|
|
Loading…
Reference in New Issue