pass 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91bcbf233648df0ab6b9b4a676eb9edc2ba9878a
4
- data.tar.gz: 6ab800006ea66bbe80c5fdfa274d056de1eae4b7
3
+ metadata.gz: df7341bf8662d2cbfba4f208c9b9c8fdee40f750
4
+ data.tar.gz: 73f98afdc71b507808f82e3579a5dc203189332c
5
5
  SHA512:
6
- metadata.gz: 06e9e65a42cf8323eb67d8f010c72040e8a9200df6b3b6a64c7116ac1d011d4eadfc3dd6c31143659588ae2f2bea3e22c8c879c2f7b9f5f4e6c0e853502b291c
7
- data.tar.gz: 1aeb65fb37aec9c688e32e33351f7b59c38e354751e727ee0f3227c35ab266e69af7b3652a7c6d3e7ed64ec238ebd356f8ecaab2bac412d6bac1e99f4c3abd38
6
+ metadata.gz: d0c5651e75f5b45bc5189cd4569e6f0502e39241b5eb8514c1bdeb6bc03fef1cd9caa4b01caad1312bdcc60a97fc5b78672148d668d9c711ffdb97dbbdb168cd
7
+ data.tar.gz: 56c47745e475854fe3e7b7fd76df7aaee8731a7ebf9614d3ea33fa4631e5f8c9ef54e0f68cfb14419ae9d87a57bc1b9bb822e0ad87a4ea299e802fa1804beff2
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .DS_Store
data/.rspec CHANGED
@@ -1 +1,2 @@
1
+ --format documentation
1
2
  --color
@@ -0,0 +1,8 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.0.0-p648
5
+ - 2.1.10
6
+ - 2.2.5
7
+ - 2.3.1
8
+ before_install: gem install bundler -v 1.13.5
data/Gemfile CHANGED
@@ -1,14 +1,4 @@
1
- source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
1
+ source 'https://rubygems.org'
5
2
 
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
- group :development do
9
- gem "rspec", "~> 2.8.0"
10
- gem "shoulda", ">= 0"
11
- gem "yard", "~> 0.7"
12
- gem "bundler", "~> 1.9.1"
13
- gem "jeweler", "~> 1.8.3"
14
- end
3
+ # Specify your gem's dependencies in pass.gemspec
4
+ gemspec
@@ -1,20 +1,21 @@
1
+ The MIT License (MIT)
2
+
1
3
  Copyright (c) 2011 Hitoshi Kurokawa
2
4
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
10
11
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
13
14
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,43 +1,6 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'rake'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
11
3
 
12
- require 'jeweler'
13
- Jeweler::Tasks.new do |gem|
14
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
- gem.name = "pass"
16
- gem.homepage = "http://github.com/krhitoshi/pass"
17
- gem.license = "MIT"
18
- gem.summary = %Q{Password Generator for CUI}
19
- gem.description = %Q{gem pass - Password Generator for CUI}
20
- gem.email = "hitoshi@nextseed.jp"
21
- gem.authors = ["Hitoshi Kurokawa"]
22
- # Include your dependencies below. Runtime dependencies are required when using your gem,
23
- # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
- # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
- # gem.add_development_dependency 'rspec', '> 1.2.3'
26
- end
27
- Jeweler::RubygemsDotOrgTasks.new
28
-
29
- require 'rspec/core'
30
- require 'rspec/core/rake_task'
31
- RSpec::Core::RakeTask.new(:spec) do |spec|
32
- spec.pattern = FileList['spec/**/*_spec.rb']
33
- end
34
-
35
- RSpec::Core::RakeTask.new(:rcov) do |spec|
36
- spec.pattern = 'spec/**/*_spec.rb'
37
- spec.rcov = true
38
- end
4
+ RSpec::Core::RakeTask.new(:spec)
39
5
 
40
6
  task :default => :spec
41
-
42
- require 'yard'
43
- YARD::Rake::YardocTask.new
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pass"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ require "pry"
10
+ Pry.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
File without changes
@@ -1,4 +1,5 @@
1
1
  require 'optparse'
2
+ require 'pass/version'
2
3
 
3
4
  class Pass
4
5
  MIN_NUM_CHARACTERS = 3
@@ -9,6 +10,8 @@ class Pass
9
10
  def initialize
10
11
  @list_carachters = ('a'..'z').to_a + ('A'..'Z').to_a + ('1'..'9').to_a - %w[l o I O 1]
11
12
  @num_iteration = 100
13
+
14
+ # Password must include digit, upper case, and lower case.
12
15
  @validation_regexps = [/\d/, /[a-z]/, /[A-Z]/]
13
16
  end
14
17
 
@@ -18,10 +21,16 @@ class Pass
18
21
  end
19
22
 
20
23
  @num_iteration.times do
21
- pass = @list_carachters.sample(num).join
24
+ rest_num = num
25
+ pass = ""
26
+ while rest_num > list_size do
27
+ pass += generate_password(list_size)
28
+ rest_num -= list_size
29
+ end
30
+ pass += generate_password(rest_num)
22
31
  return pass if valid?(pass)
23
32
  end
24
- raise "Not Converged: #{@num_iteration} times"
33
+ raise Pass::Error, "Not Converged: #{@num_iteration} times"
25
34
  end
26
35
 
27
36
  def valid?(pass)
@@ -80,12 +89,21 @@ END
80
89
  end
81
90
 
82
91
  def version
83
- number = File.read(File.dirname(__FILE__) + '/../VERSION')
84
- number.chomp
92
+ VERSION
85
93
  end
86
94
 
87
95
  private
88
96
  def integer?(value)
89
97
  value.kind_of?(Integer)
90
98
  end
99
+
100
+ def list_size
101
+ @list_carachters.size
102
+ end
103
+
104
+ def generate_password(num)
105
+ raise ArgumentError, "argument must be less than #{list_size}" if num > list_size
106
+ @list_carachters.sample(num).join
107
+ end
108
+
91
109
  end
@@ -0,0 +1,3 @@
1
+ class Pass
2
+ VERSION = "0.0.4"
3
+ end
@@ -1,65 +1,28 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
- # stub: pass 0.0.3 ruby lib
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pass/version'
6
5
 
7
- Gem::Specification.new do |s|
8
- s.name = "pass"
9
- s.version = "0.0.3"
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pass"
8
+ spec.version = Pass::VERSION
9
+ spec.authors = ["Hitoshi Kurokawa"]
10
+ spec.email = ["hitoshi@nextseed.jp"]
10
11
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["Hitoshi Kurokawa"]
14
- s.date = "2015-08-22"
15
- s.description = "gem pass - Password Generator for CUI"
16
- s.email = "hitoshi@nextseed.jp"
17
- s.executables = ["pass"]
18
- s.extra_rdoc_files = [
19
- "LICENSE.txt",
20
- "README.rdoc"
21
- ]
22
- s.files = [
23
- ".document",
24
- ".rspec",
25
- "Gemfile",
26
- "LICENSE.txt",
27
- "README.rdoc",
28
- "Rakefile",
29
- "VERSION",
30
- "bin/pass",
31
- "lib/pass.rb",
32
- "pass.gemspec",
33
- "spec/pass_spec.rb",
34
- "spec/spec_helper.rb"
35
- ]
36
- s.homepage = "http://github.com/krhitoshi/pass"
37
- s.licenses = ["MIT"]
38
- s.rubygems_version = "2.4.5"
39
- s.summary = "Password Generator for CUI"
12
+ spec.summary = %q{Password Generator for CUI}
13
+ spec.description = %q{gem pass - Password Generator for CUI}
14
+ spec.homepage = "http://github.com/krhitoshi/pass"
15
+ spec.license = "MIT"
40
16
 
41
- if s.respond_to? :specification_version then
42
- s.specification_version = 4
43
-
44
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
- s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
46
- s.add_development_dependency(%q<shoulda>, [">= 0"])
47
- s.add_development_dependency(%q<yard>, ["~> 0.7"])
48
- s.add_development_dependency(%q<bundler>, ["~> 1.9.1"])
49
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
50
- else
51
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
52
- s.add_dependency(%q<shoulda>, [">= 0"])
53
- s.add_dependency(%q<yard>, ["~> 0.7"])
54
- s.add_dependency(%q<bundler>, ["~> 1.9.1"])
55
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
56
- end
57
- else
58
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
59
- s.add_dependency(%q<shoulda>, [">= 0"])
60
- s.add_dependency(%q<yard>, ["~> 0.7"])
61
- s.add_dependency(%q<bundler>, ["~> 1.9.1"])
62
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
63
19
  end
64
- end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
65
23
 
24
+ spec.add_development_dependency "bundler", "~> 1.13"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ spec.add_development_dependency "pry"
28
+ end
metadata CHANGED
@@ -1,106 +1,92 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hitoshi Kurokawa
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-22 00:00:00.000000000 Z
11
+ date: 2016-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.8.0
19
+ version: '1.13'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.8.0
26
+ version: '1.13'
27
27
  - !ruby/object:Gem::Dependency
28
- name: shoulda
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: yard
28
+ name: rake
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: '0.7'
33
+ version: '10.0'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '0.7'
40
+ version: '10.0'
55
41
  - !ruby/object:Gem::Dependency
56
- name: bundler
42
+ name: rspec
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: 1.9.1
47
+ version: '3.0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: 1.9.1
54
+ version: '3.0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: jeweler
56
+ name: pry
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - "~>"
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
- version: 1.8.3
61
+ version: '0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - "~>"
66
+ - - ">="
81
67
  - !ruby/object:Gem::Version
82
- version: 1.8.3
68
+ version: '0'
83
69
  description: gem pass - Password Generator for CUI
84
- email: hitoshi@nextseed.jp
70
+ email:
71
+ - hitoshi@nextseed.jp
85
72
  executables:
86
73
  - pass
87
74
  extensions: []
88
- extra_rdoc_files:
89
- - LICENSE.txt
90
- - README.rdoc
75
+ extra_rdoc_files: []
91
76
  files:
92
- - ".document"
77
+ - ".gitignore"
93
78
  - ".rspec"
79
+ - ".travis.yml"
94
80
  - Gemfile
95
81
  - LICENSE.txt
96
82
  - README.rdoc
97
83
  - Rakefile
98
- - VERSION
99
- - bin/pass
84
+ - bin/console
85
+ - bin/setup
86
+ - exe/pass
100
87
  - lib/pass.rb
88
+ - lib/pass/version.rb
101
89
  - pass.gemspec
102
- - spec/pass_spec.rb
103
- - spec/spec_helper.rb
104
90
  homepage: http://github.com/krhitoshi/pass
105
91
  licenses:
106
92
  - MIT
@@ -121,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
107
  version: '0'
122
108
  requirements: []
123
109
  rubyforge_project:
124
- rubygems_version: 2.4.5
110
+ rubygems_version: 2.5.1
125
111
  signing_key:
126
112
  specification_version: 4
127
113
  summary: Password Generator for CUI
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.3
@@ -1,180 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require "stringio"
3
-
4
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
5
-
6
- describe Pass do
7
- before do
8
- @pass = Pass.new
9
- end
10
-
11
- describe "出力される文字数" do
12
- it "文字数を指定できること" do
13
- @pass.generate(3).size.should be(3)
14
- @pass.generate(12).size.should be(12)
15
- @pass.generate(30).size.should be(30)
16
- end
17
-
18
- it "文字数を指定しない場合は12文字であること" do
19
- @pass.generate.size.should be(12)
20
- end
21
- end
22
-
23
- describe "特定文字が含まれること含まれないこと" do
24
- it "文字列に数字が1文字以上含まれること" do
25
- 10.times do
26
- (@pass.generate(3) =~ /\d/).should be_true
27
- end
28
- end
29
-
30
- it "文字列に小文字が1文字以上含まれること" do
31
- 10.times do
32
- (@pass.generate(3) =~ /[a-z]/).should be_true
33
- end
34
- end
35
-
36
- it "文字列に大文字が1文字以上含まれること" do
37
- 10.times do
38
- (@pass.generate(3) =~ /[A-Z]/).should be_true
39
- end
40
- end
41
-
42
- it "見間違えやすい文字列が含まれないこと" do
43
- exclude_characters = %w[l o I O 1]
44
- 50.times do
45
- (@pass.generate =~ /[#{exclude_characters.join}]/).should be_false
46
- end
47
- end
48
- end
49
-
50
- describe "valid?" do
51
- it "validなパスワードでtrueを返すこと" do
52
- @pass.valid?("aT2").should be_true
53
- @pass.valid?("1bR").should be_true
54
- @pass.valid?("J0e").should be_true
55
- end
56
-
57
- it "invalidなパスワードでfalseを返すこと" do
58
- @pass.valid?("012").should be_false
59
- @pass.valid?("abc").should be_false
60
- @pass.valid?("ABC").should be_false
61
- @pass.valid?("0bc").should be_false
62
- @pass.valid?("0BC").should be_false
63
- @pass.valid?("AbC").should be_false
64
- end
65
- end
66
-
67
- describe "イテレーションの回数" do
68
- it "回数値を読み込めること" do
69
- @pass.num_iteration.should be(100)
70
- end
71
-
72
- it "回数値を変更できること" do
73
- @pass.num_iteration = 10
74
- @pass.num_iteration.should be(10)
75
- end
76
-
77
- it "0以下の回数値を入力すると例外を発生" do
78
- lambda{ @pass.num_iteration = 0 }.should raise_error(Pass::Error)
79
- lambda{ @pass.num_iteration = -10 }.should raise_error(Pass::Error)
80
- end
81
- end
82
-
83
- describe "例外の発生" do
84
- describe "特定回数の生成試行数を超えると例外を発生すること" do
85
- before do
86
- @pass.num_iteration = 1
87
- end
88
-
89
- after do
90
- @pass.num_iteration = 100
91
- end
92
-
93
- it do
94
- lambda{
95
- 10.times do
96
- @pass.generate(3)
97
- end
98
- }.should raise_error
99
- end
100
- end
101
-
102
- it "2以下の文字数を指定すると例外を発生すること" do
103
- lambda{ @pass.generate(2) }.should raise_error(Pass::Error)
104
- lambda{ @pass.generate(0) }.should raise_error(Pass::Error)
105
- lambda{ @pass.generate(-10) }.should raise_error(Pass::Error)
106
- end
107
-
108
- it "不正な回数値を入力すると例外を発生すること" do
109
- lambda{ @pass.num_iteration = "abc" }.should raise_error(Pass::Error)
110
- end
111
-
112
- it "不正な文字数を入力すると例外を発生すること" do
113
- lambda{ @pass.generate("abc") }.should raise_error(Pass::Error)
114
- end
115
- end
116
-
117
- describe "複数パスワードの生成" do
118
- it "指定した個数のパスワードを配列で返すこと" do
119
- @pass.multi_generate(2).size.should be(2)
120
- end
121
- end
122
-
123
- describe "コマンド用メソッド" do
124
- before do
125
- $stdout = StringIO.new
126
- end
127
-
128
- after do
129
- $stdout = STDOUT
130
- end
131
-
132
- it "オプション無しで1個のパスワードが返ってくること" do
133
- argv = [] # オプションなし
134
- lambda{ @pass.exec(argv) }.should raise_error(SystemExit)
135
- passwords = $stdout.string.chomp.split("\n")
136
- passwords.size.should be(1)
137
- passwords.first.size.should be(12)
138
- end
139
-
140
- it "パスワード数が指定できること" do
141
- argv = [20] # 20パスワード
142
- lambda{ @pass.exec(argv) }.should raise_error(SystemExit)
143
- passwords = $stdout.string.chomp.split("\n")
144
- passwords.size.should be(20)
145
- passwords.each do |password|
146
- password.size.should be(12)
147
- end
148
- end
149
-
150
- it "-cで文字数指定ができること" do
151
- argv = %w[3 -c 16] # 16文字 3パスワード
152
- lambda{ @pass.exec(argv) }.should raise_error(SystemExit)
153
- passwords = $stdout.string.chomp.split("\n")
154
- passwords.size.should be(3)
155
- passwords.each do |password|
156
- password.size.should be(16)
157
- end
158
- end
159
-
160
- it "指定順序が変わっても-cで文字数指定ができること" do
161
- argv = %w[-c 16 3] # 16文字 3パスワード
162
- lambda{ @pass.exec(argv) }.should raise_error(SystemExit)
163
- passwords = $stdout.string.chomp.split("\n")
164
- passwords.size.should be(3)
165
- passwords.each do |password|
166
- password.size.should be(16)
167
- end
168
- end
169
-
170
- it "-vでバージョン表示をするとSystemExitすること" do
171
- argv = %w[-v]
172
- lambda{ @pass.exec(argv) }.should raise_error(SystemExit)
173
- end
174
-
175
- it "-hでヘルプ表示をするとSystemExitすること" do
176
- argv = %w[-h]
177
- lambda{ @pass.exec(argv) }.should raise_error(SystemExit)
178
- end
179
- end
180
- end
@@ -1,12 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'rspec'
4
- require 'pass'
5
-
6
- # Requires supporting files with custom matchers and macros, etc,
7
- # in ./support/ and its subdirectories.
8
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
-
10
- RSpec.configure do |config|
11
-
12
- end