summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-11-10 12:40:26 -0800
committerJay Mundrawala <jdmundrawala@gmail.com>2015-11-10 12:41:19 -0800
commit93d555012c0ac0e53ec672fda610a114953c37ce (patch)
tree899c86145b87f76d3f711535cd836b389424bc6d
parente0f434d9b42263ac0bf69a9291b0ad3af7ef663c (diff)
downloadmixlib-authentication-93d555012c0ac0e53ec672fda610a114953c37ce.tar.gz
Get tests to run
-rw-r--r--.rspec1
-rw-r--r--Gemfile2
-rw-r--r--Rakefile6
-rw-r--r--lib/mixlib/authentication/signedheaderauth.rb9
-rw-r--r--mixlib-authentication.gemspec2
-rw-r--r--spec/mixlib/authentication/mixlib_authentication_spec.rb3
6 files changed, 17 insertions, 6 deletions
diff --git a/.rspec b/.rspec
index d56d9e1..53607ea 100644
--- a/.rspec
+++ b/.rspec
@@ -1,2 +1 @@
--colour
--f s
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..3be9c3c
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,2 @@
+source "https://rubygems.org"
+gemspec
diff --git a/Rakefile b/Rakefile
index b8a56a5..8bd8950 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +1,5 @@
require 'rubygems'
-require 'rake/gempackagetask'
+require 'rubygems/package_task'
require 'rubygems/specification'
require 'date'
require 'rspec/core/rake_task'
@@ -16,12 +16,12 @@ task :default => :spec
desc "Run specs"
RSpec::Core::RakeTask.new do |t|
t.pattern = 'spec/**/*_spec.rb'
- t.rspec_opts = %w(-fs --color)
+ t.rspec_opts = %w(--color)
end
gem_spec = eval(File.read("mixlib-authentication.gemspec"))
-Rake::GemPackageTask.new(gem_spec) do |pkg|
+Gem::PackageTask.new(gem_spec) do |pkg|
pkg.gem_spec = gem_spec
end
diff --git a/lib/mixlib/authentication/signedheaderauth.rb b/lib/mixlib/authentication/signedheaderauth.rb
index f37471d..85a31d4 100644
--- a/lib/mixlib/authentication/signedheaderauth.rb
+++ b/lib/mixlib/authentication/signedheaderauth.rb
@@ -65,7 +65,14 @@ module Mixlib
# These parameters are accepted but not used in the computation of the signature.
# * `:host`: The host part of the URI
def self.signing_object(args={ })
- SigningObject.new(args[:http_method], args[:path], args[:body], args[:host], args[:timestamp], args[:user_id], args[:file], args[:proto_version])
+ SigningObject.new(args[:http_method],
+ args[:path],
+ args[:body],
+ args[:host],
+ args[:timestamp],
+ args[:user_id],
+ args[:file],
+ args[:proto_version])
end
def algorithm
diff --git a/mixlib-authentication.gemspec b/mixlib-authentication.gemspec
index 7d9f038..03997d3 100644
--- a/mixlib-authentication.gemspec
+++ b/mixlib-authentication.gemspec
@@ -18,5 +18,7 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.files = %w(LICENSE README.rdoc Gemfile Rakefile NOTICE) + Dir.glob("*.gemspec") +
Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
+
+ %w(rspec-core rspec-expectations rspec-mocks).each { |gem| s.add_dependency gem, "~> 3.2" }
end
diff --git a/spec/mixlib/authentication/mixlib_authentication_spec.rb b/spec/mixlib/authentication/mixlib_authentication_spec.rb
index c16ab44..cd1a524 100644
--- a/spec/mixlib/authentication/mixlib_authentication_spec.rb
+++ b/spec/mixlib/authentication/mixlib_authentication_spec.rb
@@ -176,7 +176,8 @@ describe "Mixlib::Authentication::SignatureVerification" do
headers.delete("HTTP_X_OPS_SIGN")
mock_request = MockRequest.new(PATH, MERB_REQUEST_PARAMS, headers, BODY)
- Time.stub!(:now).and_return(TIMESTAMP_OBJ)
+ allow(Time).to receive(:now).and_return(TIMESTAMP_OBJ)
+ #Time.stub!(:now).and_return(TIMESTAMP_OBJ)
auth_req = Mixlib::Authentication::SignatureVerification.new
lambda {auth_req.authenticate_user_request(mock_request, @user_private_key)}.should raise_error(Mixlib::Authentication::AuthenticationError)