shared-secret-authentication 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -18,10 +18,19 @@ module SharedSecretAuthentication
18
18
  d.update key
19
19
  value = hash[string_keys[key]]
20
20
  if value.instance_of? Hash
21
- value = value.collect {|k,v| k.to_s + v.to_s}
21
+ value = value.collect {|k,v|
22
+ if v.respond_to? :strftime
23
+ k.to_s + v.strftime('%a %b %m %H:%M:%S %Y')
24
+ else
25
+ k.to_s + v.to_s
26
+ end
27
+ }
22
28
  end
29
+
23
30
  if value.instance_of? Array
24
31
  value = value.sort
32
+ elsif value.respond_to? :strftime
33
+ value = value.strftime('%a %b %m %H:%M:%S %Y')
25
34
  end
26
35
  d.update value.to_s
27
36
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{shared-secret-authentication}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Josh Moore"]
@@ -1,12 +1,15 @@
1
1
  require 'spec/spec_helper'
2
2
 
3
- require 'rubygems'
4
- require 'activesupport'
5
-
6
3
  describe SharedSecretAuthentication do
7
4
  before(:all) do
5
+ Object.send(:remove_const, :SHARED_SECRET)
8
6
  Object.const_set(:SHARED_SECRET, 'test')
9
7
  end
8
+
9
+ describe '.standarize_string' do
10
+ it 'should produce the same hash for all arrays no matter what the order'
11
+ end
12
+
10
13
  describe '.sign_hash' do
11
14
  it 'should respond to sign_hash' do
12
15
  SharedSecretAuthentication.should respond_to :sign_hash
@@ -62,6 +65,13 @@ describe SharedSecretAuthentication do
62
65
 
63
66
  SharedSecretAuthentication.hash_signature(hash1).should == SharedSecretAuthentication.hash_signature(hash2)
64
67
  end
68
+
69
+ it 'should produce the same signature for times in different formats' do
70
+ hash1 = {"practices"=>{"name"=>"Body Image Physical Therapy & Fitness P.C.", "mysql_updated_at"=>DateTime.parse("Thu, 03 Jun 2010 19:15:03 UTC +00:00"), "mysql_id"=>79}}
71
+ hash2 = {"practices"=>{"mysql_updated_at"=>Time.parse("2010-06-03T19:15:03Z"), "name"=>"Body Image Physical Therapy & Fitness P.C.", "mysql_id"=>79}}
72
+
73
+ SharedSecretAuthentication.hash_signature(hash1).should == SharedSecretAuthentication.hash_signature(hash2)
74
+ end
65
75
  end
66
76
  end
67
77
  end
data/spec/spec.opts CHANGED
@@ -1 +1,3 @@
1
1
  --color
2
+ --format
3
+ s
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,13 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ Bundler.require :default
5
+
3
6
  require 'shared-secret-authentication'
4
7
  require 'spec'
5
8
  require 'spec/autorun'
6
9
 
10
+
7
11
  Spec::Runner.configure do |config|
8
12
 
9
13
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shared-secret-authentication
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Josh Moore