middleman-spellcheck 0.5 → 0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15174b6762b8688b8721627d0081b7d279c1369c
4
- data.tar.gz: b19a2d36f45f0b230ab58c99501f2476782d0577
3
+ metadata.gz: f583af567927055546ed6b90a526a32f7dd5da52
4
+ data.tar.gz: de8929bfe29e132208fdea35a3eaec7dbb141fa5
5
5
  SHA512:
6
- metadata.gz: 12dfadaeb7784ce7025e1ca8dd4592b38e83d98af91998e1bb7acc2f74020a9165feaba7cee01755749e321d12e0b5b2a968b5ac6a37f5a95f4fddb4ae9de72b
7
- data.tar.gz: d5ad3df3d78a1acae85c051bf11f11bcb3f34814feff4ffdf36aa4dcfbb5e9f95fd4317c7b1d39b172540209597eb3238e738a582e111c0bf41358c680648500
6
+ metadata.gz: 52273fd663fed6722d2f711bfc712cc926ac46bfe25495438e65841fbb6668811e3b865c68355f4e3d3876fa91e458baf50f7867d0413099dac6c4dcf21fb5a1
7
+ data.tar.gz: 67ed22641c257e5904f58d9a06aa6d63312d0f2a7833af7b583a7d789c49708438295aaaaeb5ab6929e7954e16c30233f0664a5e83ec24c04abf651e9d5e9e98
data/Gemfile CHANGED
@@ -8,4 +8,5 @@ group :test do
8
8
  gem "cucumber", "~> 1.3.1"
9
9
  gem "fivemat"
10
10
  gem "aruba", "~> 0.5.1"
11
+ gem "rspec"
11
12
  end
@@ -10,7 +10,7 @@ class Spellchecker
10
10
  end
11
11
 
12
12
  def self.query(text, lang='en')
13
- result = `echo "#{text}" | #{@@aspell_path} -a -l #{lang}`
13
+ result = `echo "#{format_text(text)}" | #{@@aspell_path} -a -l #{lang}`
14
14
  raise 'Aspell command not found' unless result
15
15
  result.split("\n")[1..-1] || []
16
16
  end
@@ -19,6 +19,10 @@ class Spellchecker
19
19
  result_string == "*"
20
20
  end
21
21
 
22
+ def self.format_text(text)
23
+ text.gsub("\n", "")
24
+ end
25
+
22
26
  def self.check(text, lang='en')
23
27
  words = text.split(/\W+/)
24
28
  results = query(text, lang).map do |query_result|
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Spellcheck
3
- VERSION = "0.5"
3
+ VERSION = "0.6"
4
4
  end
5
5
  end
@@ -5,10 +5,25 @@ describe Spellchecker do
5
5
  let(:text) { "hello, world! of txet" }
6
6
  let(:result) { Spellchecker.check(text) }
7
7
 
8
- it "can spell check words" do
9
- result.should == [{ word: "hello", correct: true },
10
- { word: "world", correct: true },
11
- { word: "of", correct: true },
12
- { word: "txet", correct: false }]
8
+ context "with one wrong word" do
9
+ it "can spell check words" do
10
+ result.should == [{ word: "hello", correct: true },
11
+ { word: "world", correct: true },
12
+ { word: "of", correct: true },
13
+ { word: "txet", correct: false }]
14
+ end
15
+ end
16
+
17
+ context "ignoring special characters" do
18
+ let(:text) { "Hello, dear!\nMy name is Lucy."}
19
+
20
+ it "spells correctly with newline characters" do
21
+ result.should == [{ word: "Hello", correct: true },
22
+ { word: "dear", correct: true},
23
+ { word: "My", correct: true},
24
+ { word: "name", correct: true},
25
+ { word: "is", correct: true},
26
+ { word: "Lucy", correct: true}]
27
+ end
13
28
  end
14
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-spellcheck
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Zarea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-04 00:00:00.000000000 Z
11
+ date: 2014-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core