zxcvbn-ruby 0.0.1 → 0.0.2

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.
@@ -14,7 +14,7 @@ module Zxcvbn
14
14
  dictionary = {}
15
15
  i = 1
16
16
  words.each do |word|
17
- dictionary[word] = i
17
+ dictionary[word.downcase] = i
18
18
  i += 1
19
19
  end
20
20
  dictionary
@@ -1,3 +1,3 @@
1
1
  module Zxcvbn
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Zxcvbn::DictionaryRanker do
4
+ describe '.rank_dictionaries' do
5
+ it 'ranks word lists' do
6
+ result = Zxcvbn::DictionaryRanker.rank_dictionaries({:test => ['ABC', 'def'],
7
+ :test2 => ['def', 'ABC']})
8
+ result[:test].should eq({'abc' => 1, 'def' => 2})
9
+ result[:test2].should eq({'def' => 1, 'abc' => 2})
10
+ end
11
+ end
12
+ end
@@ -11,4 +11,9 @@ describe Zxcvbn::Matchers::Dictionary do
11
11
  'sin', 'i', 'in', 'i', 'it']
12
12
  matches.map(&:matched_word).should == expected_matches
13
13
  end
14
+
15
+ it 'matches uppercase' do
16
+ matcher = described_class.new('user_inputs', Zxcvbn::DictionaryRanker.rank_dictionary(['test','AB10CD']))
17
+ matcher.matches('AB10CD').should_not be_empty
18
+ end
14
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zxcvbn-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-01 00:00:00.000000000 Z
13
+ date: 2013-01-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: therubyracer
@@ -81,6 +81,7 @@ files:
81
81
  - lib/zxcvbn/score.rb
82
82
  - lib/zxcvbn/scorer.rb
83
83
  - lib/zxcvbn/version.rb
84
+ - spec/dictionary_ranker_spec.rb
84
85
  - spec/matchers/date_spec.rb
85
86
  - spec/matchers/dictionary_spec.rb
86
87
  - spec/matchers/digits_spec.rb
@@ -122,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
123
  version: '0'
123
124
  segments:
124
125
  - 0
125
- hash: 3138366731839497742
126
+ hash: -3056497294022878543
126
127
  required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  none: false
128
129
  requirements:
@@ -131,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
132
  version: '0'
132
133
  segments:
133
134
  - 0
134
- hash: 3138366731839497742
135
+ hash: -3056497294022878543
135
136
  requirements: []
136
137
  rubyforge_project:
137
138
  rubygems_version: 1.8.23
@@ -139,6 +140,7 @@ signing_key:
139
140
  specification_version: 3
140
141
  summary: ''
141
142
  test_files:
143
+ - spec/dictionary_ranker_spec.rb
142
144
  - spec/matchers/date_spec.rb
143
145
  - spec/matchers/dictionary_spec.rb
144
146
  - spec/matchers/digits_spec.rb