Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ gemspec

# Dev libs
gem 'faker'
gem 'forgery'
gem 'pry'
gem 'rake'
gem 'rspec'
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'simplecov'
require 'forgery'
require 'rspec'
require 'faker'
require 'support/helper'
Expand Down
70 changes: 35 additions & 35 deletions spec/unit_tests/ssh_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
describe '#new' do
it 'should create a valid ssh key' do
type = "ssh-rsa"
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
email = Forgery::Internet.email_address
blob = Faker::Internet.password(:min_length => 372, :max_length => 372)
email = Faker::Internet.email

s = Gitolite::SSHKey.new(type, blob, email)

Expand All @@ -109,9 +109,9 @@

it 'should create a valid ssh key while specifying an owner' do
type = "ssh-rsa"
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
email = Forgery::Internet.email_address
owner = Forgery::Name.first_name
blob = Faker::Internet.password(:min_length => 372, :max_length => 372)
email = Faker::Internet.email
owner = Faker::Name.first_name

s = Gitolite::SSHKey.new(type, blob, email, owner)

Expand All @@ -121,10 +121,10 @@

it 'should create a valid ssh key while specifying an owner and location' do
type = "ssh-rsa"
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
email = Forgery::Internet.email_address
owner = Forgery::Name.first_name
location = Forgery::Name.location
blob = Faker::Internet.password(:min_length => 372, :max_length => 372)
email = Faker::Internet.email
owner = Faker::Name.first_name
location = Faker::Company.name

s = Gitolite::SSHKey.new(type, blob, email, owner, location)

Expand All @@ -138,10 +138,10 @@
describe '#hash' do
it 'should have two hash equalling one another' do
type = "ssh-rsa"
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
email = Forgery::Internet.email_address
owner = Forgery::Name.first_name
location = Forgery::Name.location
blob = Faker::Internet.password(:min_length => 372, :max_length => 372)
email = Faker::Internet.email
owner = Faker::Name.first_name
location = Faker::Company.name

hash_test = [owner, location, type, blob, email].hash
s = Gitolite::SSHKey.new(type, blob, email, owner, location)
Expand All @@ -154,8 +154,8 @@
describe '#filename' do
it 'should create a filename that is the <email>.pub' do
type = "ssh-rsa"
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
email = Forgery::Internet.email_address
blob = Faker::Internet.password(:min_length => 372, :max_length => 372)
email = Faker::Internet.email

s = Gitolite::SSHKey.new(type, blob, email)

Expand All @@ -164,9 +164,9 @@

it 'should create a filename that is the <owner>.pub' do
type = "ssh-rsa"
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
email = Forgery::Internet.email_address
owner = Forgery::Name.first_name
blob = Faker::Internet.password(:min_length => 372, :max_length => 372)
email = Faker::Internet.email
owner = Faker::Name.first_name

s = Gitolite::SSHKey.new(type, blob, email, owner)

Expand All @@ -175,9 +175,9 @@

it 'should create a filename that is the <email>.pub' do
type = "ssh-rsa"
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
email = Forgery::Internet.email_address
location = Forgery::Basic.text(:at_least => 8, :at_most => 15)
blob = Faker::Internet.password(:min_length => 372, :max_length => 372)
email = Faker::Internet.email
location = Faker::Internet.password(:min_length => 8, :max_length => 15)

s = Gitolite::SSHKey.new(type, blob, email, nil, location)

Expand All @@ -187,10 +187,10 @@

it 'should create a filename that is the <owner>@<location>.pub' do
type = "ssh-rsa"
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
email = Forgery::Internet.email_address
owner = Forgery::Name.first_name
location = Forgery::Basic.text(:at_least => 8, :at_most => 15)
blob = Faker::Internet.password(:min_length => 372, :max_length => 372)
email = Faker::Internet.email
owner = Faker::Name.first_name
location = Faker::Internet.password(:min_length => 8, :max_length => 15)

s = Gitolite::SSHKey.new(type, blob, email, owner, location)

Expand All @@ -202,10 +202,10 @@
describe '#to_file' do
it 'should write a "valid" SSH public key to the file system' do
type = "ssh-rsa"
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
email = Forgery::Internet.email_address
owner = Forgery::Name.first_name
location = Forgery::Basic.text(:at_least => 8, :at_most => 15)
blob = Faker::Internet.password(:min_length => 372, :max_length => 372)
email = Faker::Internet.email
owner = Faker::Name.first_name
location = Faker::Internet.password(:min_length => 8, :max_length => 15)

s = Gitolite::SSHKey.new(type, blob, email, owner, location)

Expand All @@ -218,10 +218,10 @@

it 'should return the filename written' do
type = "ssh-rsa"
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
email = Forgery::Internet.email_address
owner = Forgery::Name.first_name
location = Forgery::Basic.text(:at_least => 8, :at_most => 15)
blob = Faker::Internet.password(:min_length => 372, :max_length => 372)
email = Faker::Internet.email
owner = Faker::Name.first_name
location = Faker::Internet.password(:min_length => 8, :max_length => 15)

s = Gitolite::SSHKey.new(type, blob, email, owner, location)
expect(s.to_file(output_dir)).to eq File.join(output_dir, owner, location, s.filename)
Expand All @@ -232,8 +232,8 @@
describe '==' do
it 'should have two keys equalling one another' do
type = "ssh-rsa"
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
email = Forgery::Internet.email_address
blob = Faker::Internet.password(:min_length => 372, :max_length => 372)
email = Faker::Internet.email

s1 = Gitolite::SSHKey.new(type, blob, email)
s2 = Gitolite::SSHKey.new(type, blob, email)
Expand Down