Skip to content

Commit

Permalink
Added more method tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuart Ellis committed Sep 26, 2010
1 parent 8131598 commit 5e5f054
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions spec/lingua/en/readability_spec.rb
Expand Up @@ -15,6 +15,24 @@
@report = Lingua::EN::Readability.new(@text)
end

describe "#flesch" do
it "should be the correct Flesch Reading Ease" do
@report.flesch.should be_close(71.471, 0.001)
end
end

describe "#fog" do
it "should be the correct Gunning Fog Index" do
@report.fog.should be_close(10.721, 0.001)
end
end

describe "#kincaid" do
it "should be the correct Flesch-Kincaid grade level" do
@report.kincaid.should be_close(7.5, 0.1)
end
end

describe "#num_chars" do
it "should be the correct count of characters" do
@report.num_chars.should == 1405
Expand Down Expand Up @@ -57,6 +75,18 @@
end
end

describe "#percent_fog_complex_words" do
it "should be the correct percentage of complex words according to Fog Index" do
@report.percent_fog_complex_words.should be_close(9.803, 0.001)
end
end

describe "#syllables_per_word" do
it "should be the correct average of syllables per word" do
@report.syllables_per_word.should be_close(1.396, 0.001)
end
end

describe "#unique_words" do
it "should be an array of unique words" do
unique_words = @report.unique_words
Expand All @@ -70,4 +100,5 @@
@report.words_per_sentence.should be_close(17.0, 0.001)
end
end

end

0 comments on commit 5e5f054

Please sign in to comment.