ronin 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +11 -0
  3. data/.github/workflows/ruby.yml +32 -0
  4. data/.gitignore +7 -7
  5. data/.ruby-version +1 -0
  6. data/COPYING.txt +3 -3
  7. data/ChangeLog.md +25 -11
  8. data/Gemfile +21 -20
  9. data/README.md +102 -81
  10. data/Rakefile +4 -5
  11. data/bin/ronin +7 -12
  12. data/bin/ronin-campaigns +7 -12
  13. data/bin/ronin-console +7 -12
  14. data/bin/ronin-creds +7 -12
  15. data/bin/ronin-database +7 -12
  16. data/bin/ronin-emails +7 -12
  17. data/bin/ronin-exec +7 -12
  18. data/bin/ronin-fuzzer +7 -12
  19. data/bin/ronin-help +7 -12
  20. data/bin/ronin-hosts +7 -12
  21. data/bin/ronin-install +7 -12
  22. data/bin/ronin-ips +7 -12
  23. data/bin/ronin-net-proxy +7 -12
  24. data/bin/ronin-repos +7 -12
  25. data/bin/ronin-uninstall +7 -12
  26. data/bin/ronin-update +7 -12
  27. data/bin/ronin-urls +7 -12
  28. data/bin/ronin-wordlist +7 -12
  29. data/gemspec.yml +8 -8
  30. data/lib/bond/completions/ronin.rb +23 -23
  31. data/lib/ronin.rb +3 -3
  32. data/lib/ronin/address.rb +6 -7
  33. data/lib/ronin/arch.rb +3 -3
  34. data/lib/ronin/author.rb +5 -7
  35. data/lib/ronin/auto_load.rb +5 -5
  36. data/lib/ronin/bootstrap.rb +3 -3
  37. data/lib/ronin/campaign.rb +3 -3
  38. data/lib/ronin/config.rb +5 -7
  39. data/lib/ronin/credential.rb +3 -3
  40. data/lib/ronin/database.rb +3 -3
  41. data/lib/ronin/database/database.rb +8 -12
  42. data/lib/ronin/database/exceptions.rb +3 -3
  43. data/lib/ronin/database/exceptions/invalid_config.rb +3 -3
  44. data/lib/ronin/database/exceptions/unknown_repository.rb +3 -3
  45. data/lib/ronin/database/migrations.rb +3 -3
  46. data/lib/ronin/database/migrations/1.0.0.rb +3 -3
  47. data/lib/ronin/database/migrations/1.1.0.rb +3 -3
  48. data/lib/ronin/database/migrations/exceptions.rb +3 -3
  49. data/lib/ronin/database/migrations/exceptions/duplicate_migration.rb +3 -3
  50. data/lib/ronin/database/migrations/exceptions/unknown_migration.rb +3 -3
  51. data/lib/ronin/database/migrations/graph.rb +3 -3
  52. data/lib/ronin/database/migrations/migration.rb +3 -3
  53. data/lib/ronin/database/migrations/migrations.rb +3 -3
  54. data/lib/ronin/email_address.rb +5 -7
  55. data/lib/ronin/environment.rb +3 -3
  56. data/lib/ronin/exceptions.rb +3 -3
  57. data/lib/ronin/exceptions/duplicate_repository.rb +3 -3
  58. data/lib/ronin/exceptions/repository_not_found.rb +3 -3
  59. data/lib/ronin/host_name.rb +3 -3
  60. data/lib/ronin/host_name_ip_address.rb +3 -3
  61. data/lib/ronin/installation.rb +5 -7
  62. data/lib/ronin/ip_address.rb +6 -8
  63. data/lib/ronin/ip_address_mac_address.rb +3 -3
  64. data/lib/ronin/license.rb +6 -6
  65. data/lib/ronin/mac_address.rb +3 -3
  66. data/lib/ronin/model.rb +3 -3
  67. data/lib/ronin/model/has_authors.rb +3 -3
  68. data/lib/ronin/model/has_description.rb +3 -3
  69. data/lib/ronin/model/has_license.rb +3 -3
  70. data/lib/ronin/model/has_name.rb +3 -3
  71. data/lib/ronin/model/has_title.rb +3 -3
  72. data/lib/ronin/model/has_unique_name.rb +5 -7
  73. data/lib/ronin/model/has_version.rb +3 -3
  74. data/lib/ronin/model/importable.rb +3 -3
  75. data/lib/ronin/model/model.rb +7 -8
  76. data/lib/ronin/model/types.rb +3 -3
  77. data/lib/ronin/model/types/description.rb +9 -12
  78. data/lib/ronin/open_port.rb +5 -7
  79. data/lib/ronin/organization.rb +3 -3
  80. data/lib/ronin/os.rb +5 -7
  81. data/lib/ronin/os_guess.rb +3 -3
  82. data/lib/ronin/password.rb +3 -3
  83. data/lib/ronin/port.rb +3 -3
  84. data/lib/ronin/repositories.rb +3 -3
  85. data/lib/ronin/repository.rb +3 -3
  86. data/lib/ronin/ronin.rb +3 -3
  87. data/lib/ronin/script.rb +3 -3
  88. data/lib/ronin/script/buildable.rb +3 -3
  89. data/lib/ronin/script/deployable.rb +3 -3
  90. data/lib/ronin/script/exceptions.rb +3 -3
  91. data/lib/ronin/script/exceptions/build_failed.rb +3 -3
  92. data/lib/ronin/script/exceptions/deploy_failed.rb +3 -3
  93. data/lib/ronin/script/exceptions/exception.rb +3 -3
  94. data/lib/ronin/script/exceptions/not_built.rb +3 -3
  95. data/lib/ronin/script/exceptions/test_failed.rb +3 -3
  96. data/lib/ronin/script/path.rb +3 -3
  97. data/lib/ronin/script/script.rb +3 -3
  98. data/lib/ronin/script/testable.rb +3 -3
  99. data/lib/ronin/service.rb +3 -3
  100. data/lib/ronin/service_credential.rb +3 -3
  101. data/lib/ronin/software.rb +3 -3
  102. data/lib/ronin/spec/database.rb +27 -21
  103. data/lib/ronin/target.rb +3 -3
  104. data/lib/ronin/tcp_port.rb +3 -3
  105. data/lib/ronin/udp_port.rb +3 -3
  106. data/lib/ronin/ui.rb +3 -3
  107. data/lib/ronin/ui/cli.rb +3 -3
  108. data/lib/ronin/ui/cli/class_command.rb +14 -7
  109. data/lib/ronin/ui/cli/cli.rb +5 -5
  110. data/lib/ronin/ui/cli/command.rb +5 -7
  111. data/lib/ronin/ui/cli/commands.rb +3 -3
  112. data/lib/ronin/ui/cli/commands/campaigns.rb +5 -7
  113. data/lib/ronin/ui/cli/commands/console.rb +3 -3
  114. data/lib/ronin/ui/cli/commands/creds.rb +3 -3
  115. data/lib/ronin/ui/cli/commands/database.rb +3 -3
  116. data/lib/ronin/ui/cli/commands/emails.rb +3 -3
  117. data/lib/ronin/ui/cli/commands/exec.rb +3 -3
  118. data/lib/ronin/ui/cli/commands/fuzzer.rb +16 -16
  119. data/lib/ronin/ui/cli/commands/help.rb +3 -3
  120. data/lib/ronin/ui/cli/commands/hosts.rb +5 -7
  121. data/lib/ronin/ui/cli/commands/install.rb +7 -11
  122. data/lib/ronin/ui/cli/commands/ips.rb +5 -7
  123. data/lib/ronin/ui/cli/commands/net/proxy.rb +19 -12
  124. data/lib/ronin/ui/cli/commands/repos.rb +3 -3
  125. data/lib/ronin/ui/cli/commands/uninstall.rb +3 -3
  126. data/lib/ronin/ui/cli/commands/update.rb +3 -3
  127. data/lib/ronin/ui/cli/commands/urls.rb +3 -3
  128. data/lib/ronin/ui/cli/commands/wordlist.rb +3 -3
  129. data/lib/ronin/ui/cli/exceptions.rb +3 -3
  130. data/lib/ronin/ui/cli/exceptions/unknown_command.rb +3 -3
  131. data/lib/ronin/ui/cli/model_command.rb +6 -9
  132. data/lib/ronin/ui/cli/printing.rb +3 -3
  133. data/lib/ronin/ui/cli/resources_command.rb +7 -11
  134. data/lib/ronin/ui/cli/script_command.rb +5 -10
  135. data/lib/ronin/ui/console.rb +3 -3
  136. data/lib/ronin/ui/console/commands.rb +3 -3
  137. data/lib/ronin/ui/console/console.rb +3 -3
  138. data/lib/ronin/ui/console/context.rb +3 -3
  139. data/lib/ronin/ui/console/shell.rb +3 -3
  140. data/lib/ronin/url.rb +5 -7
  141. data/lib/ronin/url_query_param.rb +3 -3
  142. data/lib/ronin/url_query_param_name.rb +6 -6
  143. data/lib/ronin/url_scheme.rb +4 -4
  144. data/lib/ronin/user_name.rb +3 -3
  145. data/lib/ronin/vendor.rb +3 -3
  146. data/lib/ronin/version.rb +5 -5
  147. data/lib/ronin/web_credential.rb +5 -7
  148. data/man/ronin-campaigns.1.md +20 -20
  149. data/man/ronin-console.1.md +17 -17
  150. data/man/ronin-creds.1.md +16 -16
  151. data/man/ronin-database.1.md +23 -23
  152. data/man/ronin-emails.1.md +18 -18
  153. data/man/ronin-exec.1.md +11 -11
  154. data/man/ronin-fuzzer.1.md +23 -23
  155. data/man/ronin-help.1.md +5 -5
  156. data/man/ronin-hosts.1.md +20 -20
  157. data/man/ronin-install.1.md +18 -18
  158. data/man/ronin-ips.1.md +21 -21
  159. data/man/ronin-net-proxy.1.md +24 -24
  160. data/man/ronin-repos.1.md +18 -18
  161. data/man/ronin-uninstall.1.md +14 -14
  162. data/man/ronin-update.1.md +14 -14
  163. data/man/ronin-urls.1.md +22 -22
  164. data/man/ronin-wordlist.1.md +14 -13
  165. data/man/ronin.1.md +1 -1
  166. data/spec/arch_spec.rb +59 -46
  167. data/spec/author_spec.rb +14 -14
  168. data/spec/campaign_spec.rb +8 -0
  169. data/spec/credential_spec.rb +11 -8
  170. data/spec/database_spec.rb +6 -6
  171. data/spec/email_address_spec.rb +23 -20
  172. data/spec/host_name_spec.rb +24 -22
  173. data/spec/installation_spec.rb +6 -6
  174. data/spec/ip_address_spec.rb +31 -26
  175. data/spec/license_spec.rb +15 -9
  176. data/spec/mac_address_spec.rb +17 -8
  177. data/spec/model/has_authors_spec.rb +56 -37
  178. data/spec/model/has_description_spec.rb +36 -23
  179. data/spec/model/has_license_spec.rb +38 -28
  180. data/spec/model/has_name_spec.rb +36 -19
  181. data/spec/model/has_title_spec.rb +27 -14
  182. data/spec/model/has_version_spec.rb +64 -35
  183. data/spec/model/model_spec.rb +57 -33
  184. data/spec/model/models/{basic_model.rb → base_model.rb} +1 -1
  185. data/spec/model/models/{custom_model.rb → inherited_model.rb} +2 -3
  186. data/spec/os_spec.rb +24 -20
  187. data/spec/password_spec.rb +17 -9
  188. data/spec/port_spec.rb +30 -22
  189. data/spec/repository_spec.rb +59 -60
  190. data/spec/ronin_spec.rb +4 -4
  191. data/spec/script/buildable_spec.rb +8 -8
  192. data/spec/script/deployable_spec.rb +7 -7
  193. data/spec/script/path_spec.rb +42 -40
  194. data/spec/script/script_spec.rb +23 -23
  195. data/spec/script/testable_spec.rb +20 -20
  196. data/spec/service_spec.rb +14 -8
  197. data/spec/software_spec.rb +30 -17
  198. data/spec/spec_helper.rb +4 -4
  199. data/spec/ui/cli/classes/test_command.rb +2 -4
  200. data/spec/ui/cli/cli_spec.rb +5 -5
  201. data/spec/ui/cli/command_spec.rb +34 -30
  202. data/spec/url_query_param_spec.rb +23 -14
  203. data/spec/url_scheme_spec.rb +12 -9
  204. data/spec/url_spec.rb +64 -61
  205. data/spec/vendor_spec.rb +15 -8
  206. metadata +122 -150
  207. data/.gemtest +0 -0
@@ -4,26 +4,39 @@ require 'model/models/titled_model'
4
4
  require 'ronin/model/has_title'
5
5
 
6
6
  describe Model::HasTitle do
7
- subject { TitledModel }
7
+ let(:model) { TitledModel }
8
8
 
9
- before(:all) { subject.auto_migrate! }
9
+ describe ".included" do
10
+ subject { model }
10
11
 
11
- it "should include Ronin::Model" do
12
- subject.ancestors.should include(Model)
13
- end
12
+ it "should include Ronin::Model" do
13
+ expect(subject.ancestors).to include(Model)
14
+ end
14
15
 
15
- it "should define a title property" do
16
- subject.properties.should be_named(:title)
16
+ it "should define a title property" do
17
+ expect(subject.properties).to be_named(:title)
18
+ end
17
19
  end
18
20
 
19
- it "should be able to find resources with similar titles" do
20
- subject.create!(:title => 'Foo one')
21
- subject.create!(:title => 'Foo bar two')
21
+ describe ".titled" do
22
+ subject { model }
23
+
24
+ let(:title1) { 'Foo one' }
25
+ let(:title2) { 'Foo bar two' }
26
+
27
+ before do
28
+ subject.create!(:title => title1)
29
+ subject.create!(:title => title2)
30
+ end
31
+
32
+ it "should be able to find resources with similar titles" do
33
+ resources = subject.titled('Foo')
22
34
 
23
- resources = subject.titled('Foo')
35
+ expect(resources.length).to eq(2)
36
+ expect(resources[0].title).to be == title1
37
+ expect(resources[1].title).to be == title2
38
+ end
24
39
 
25
- resources.length.should == 2
26
- resources[0].title.should == 'Foo one'
27
- resources[1].title.should == 'Foo bar two'
40
+ after { subject.destroy }
28
41
  end
29
42
  end
@@ -4,55 +4,84 @@ require 'model/models/versioned_model'
4
4
  require 'ronin/model/has_version'
5
5
 
6
6
  describe Model::HasVersion do
7
- subject { VersionedModel }
7
+ let(:model) { VersionedModel }
8
8
 
9
- before(:all) do
10
- subject.auto_migrate!
9
+ describe ".included" do
10
+ subject { model }
11
11
 
12
- subject.create(
13
- :version => '1.1',
14
- :content => 'Foo'
15
- )
12
+ it "should include Ronin::Model" do
13
+ expect(subject.ancestors).to include(Model)
14
+ end
16
15
 
17
- subject.create(
18
- :version => '1.1',
19
- :content => 'Bar'
20
- )
16
+ it "should define a version property" do
17
+ expect(subject.properties).to be_named(:version)
18
+ end
21
19
 
22
- subject.create(
23
- :version => '1.2',
24
- :content => 'Foo'
25
- )
26
- end
20
+ it "should default the version property to '0.1'" do
21
+ resource = subject.new
27
22
 
28
- it "should include Ronin::Model" do
29
- subject.ancestors.should include(Model)
23
+ expect(resource.version).to eq('0.1')
24
+ end
30
25
  end
31
26
 
32
- it "should define a version property" do
33
- subject.properties.should be_named(:version)
34
- end
27
+ describe ".revision" do
28
+ subject { model }
35
29
 
36
- it "should default the version property to '1.0'" do
37
- resource = subject.new
30
+ before do
31
+ subject.create(
32
+ :version => '1.1',
33
+ :content => 'one'
34
+ )
38
35
 
39
- resource.version.should == '0.1'
40
- end
36
+ subject.create(
37
+ :version => '1.1',
38
+ :content => 'two'
39
+ )
40
+
41
+ subject.create(
42
+ :version => '1.2',
43
+ :content => 'three'
44
+ )
45
+ end
46
+
47
+ it "should allow querying specific revisions" do
48
+ resources = subject.revision('1.1')
41
49
 
42
- it "should allow querying specific revisions" do
43
- resources = subject.revision('1.1')
50
+ expect(resources.length).to eq(2)
51
+ expect(resources[0].version).to eq('1.1')
52
+ expect(resources[0].content).to eq('one')
44
53
 
45
- resources.length.should == 2
46
- resources[0].version.should == '1.1'
47
- resources[0].content.should == 'Foo'
54
+ expect(resources[1].version).to eq('1.1')
55
+ expect(resources[1].content).to eq('two')
56
+ end
48
57
 
49
- resources[1].version.should == '1.1'
50
- resources[1].content.should == 'Bar'
58
+ after { subject.destroy }
51
59
  end
52
60
 
53
- it "should allow querying the latest revision" do
54
- resource = subject.all(:content => 'Foo').latest
61
+ describe ".latest" do
62
+ subject { model }
63
+
64
+ before do
65
+ subject.create(
66
+ :version => '1.0',
67
+ :content => 'foo'
68
+ )
69
+
70
+ subject.create(
71
+ :version => '1.5',
72
+ :content => 'foo'
73
+ )
74
+
75
+ subject.create(
76
+ :version => '1.1',
77
+ :content => 'foo'
78
+ )
79
+ end
80
+
81
+ it "should allow querying the latest revision" do
82
+ resource = subject.all(:content => 'foo').latest
55
83
 
56
- resource.version.should == '1.2'
84
+ expect(resource.version).to eq('1.5')
85
+ end
57
86
  end
58
87
  end
@@ -1,74 +1,98 @@
1
1
  require 'spec_helper'
2
- require 'model/models/basic_model'
3
- require 'model/models/custom_model'
2
+ require 'model/models/base_model'
3
+ require 'model/models/inherited_model'
4
4
 
5
5
  require 'ronin/model/model'
6
6
 
7
7
  describe Model do
8
- subject { BasicModel }
8
+ let(:base_model) { BaseModel }
9
+ let(:inherited_model) { InheritedModel }
9
10
 
10
- let(:custom_model) { CustomModel }
11
+ describe ".included" do
12
+ subject { base_model }
11
13
 
12
- before(:all) { subject.auto_migrate! }
13
-
14
- it "should have a default repository name" do
15
- subject.default_repository_name.should == :default
14
+ it "should have a default repository name" do
15
+ expect(subject.default_repository_name).to eq(:default)
16
+ end
16
17
  end
17
18
 
18
- it "should allow creating new instances of the model" do
19
- resource = subject.new(:name => 'joe')
19
+ describe ".new" do
20
+ subject { base_model }
20
21
 
21
- resource.name.should == 'joe'
22
- end
22
+ it "should allow creating new instances of the model" do
23
+ resource = subject.new(:name => 'joe')
24
+
25
+ expect(resource.name).to eq('joe')
26
+ end
27
+
28
+ context "when the model defines an initialize method" do
29
+ subject { inherited_model }
23
30
 
24
- it "should call initialize when creating new instances of the model" do
25
- resource = custom_model.new(:name => 'joe')
31
+ it "should call initialize when creating new instances of the model" do
32
+ resource = subject.new(:name => 'joe')
26
33
 
27
- resource.name.should == 'joe'
28
- resource.var.should == 2
34
+ expect(resource.name).to eq('joe')
35
+ expect(resource.var).to eq(2)
36
+ end
37
+ end
29
38
  end
30
39
 
31
- it "should call initialize when creating a new resource" do
32
- resource = custom_model.create!(:name => 'jim')
40
+ describe ".create!" do
41
+ subject { inherited_model }
42
+
43
+ it "should call initialize when creating a new resource" do
44
+ resource = subject.create!(:name => 'jim')
33
45
 
34
- resource.name.should == 'jim'
35
- resource.var.should == 2
46
+ expect(resource.name).to eq('jim')
47
+ expect(resource.var).to eq(2)
48
+
49
+ resource.destroy
50
+ end
36
51
  end
37
52
 
38
- it "should call initialize when loading from the database" do
39
- custom_model.create!(:name => 'bob')
53
+ describe ".first" do
54
+ subject { inherited_model }
55
+
56
+ before { subject.create!(:name => 'bob') }
57
+
58
+ it "should call initialize when loading from the database" do
59
+ resource = subject.first(:name => 'bob')
40
60
 
41
- resource = custom_model.first(:name => 'bob')
42
- resource.name.should == 'bob'
43
- resource.var.should == 2
61
+ expect(resource.name).to eq('bob')
62
+ expect(resource.var).to eq(2)
63
+ end
64
+
65
+ after { subject.destroy }
44
66
  end
45
67
 
46
- describe "humanize_attributes" do
47
- let(:resource) { subject.new(:name => 'joe', :age => 21) }
68
+ describe "#humanize_attributes" do
69
+ let(:model) { base_model }
70
+
71
+ subject { model.new(:name => 'joe', :age => 21) }
48
72
 
49
73
  it "should humanize the attributes of a model" do
50
- resource.humanize_attributes.should == {
74
+ expect(subject.humanize_attributes).to be == {
51
75
  'Name' => 'joe',
52
76
  'Age' => '21'
53
77
  }
54
78
  end
55
79
 
56
80
  it "should exclude certain attributes to humanize" do
57
- resource.humanize_attributes(:exclude => [:name]).should == {
81
+ expect(subject.humanize_attributes(:exclude => [:name])).to be == {
58
82
  'Age' => '21'
59
83
  }
60
84
  end
61
85
 
62
86
  it "should filter out nil values" do
63
- resource.age = nil
87
+ subject.age = nil
64
88
 
65
- resource.humanize_attributes.should == {'Name' => 'joe'}
89
+ expect(subject.humanize_attributes).to be == {'Name' => 'joe'}
66
90
  end
67
91
 
68
92
  it "should filter out empty values" do
69
- resource.name = ''
93
+ subject.name = ''
70
94
 
71
- resource.humanize_attributes.should == {'Age' => '21'}
95
+ expect(subject.humanize_attributes).to be == {'Age' => '21'}
72
96
  end
73
97
  end
74
98
  end
@@ -1,6 +1,6 @@
1
1
  require 'ronin/model/model'
2
2
 
3
- class BasicModel
3
+ class BaseModel
4
4
 
5
5
  include Ronin::Model
6
6
 
@@ -1,8 +1,7 @@
1
1
  require 'ronin/model/model'
2
+ require_relative 'base_model'
2
3
 
3
- require 'model/models/basic_model'
4
-
5
- class CustomModel < BasicModel
4
+ class InheritedModel < BaseModel
6
5
 
7
6
  include Ronin::Model
8
7
 
data/spec/os_spec.rb CHANGED
@@ -1,44 +1,48 @@
1
1
  require 'spec_helper'
2
+
2
3
  require 'ronin/os'
3
4
 
4
5
  describe OS do
5
- subject do
6
- OS.new(:name => 'Linux', :version => '2.6.11')
7
- end
6
+ let(:name) { 'Linux' }
7
+ let(:version) { '2.6.11' }
8
+
9
+ subject { described_class.new(:name => name, :version => version) }
8
10
 
9
11
  describe "predefine" do
10
- it "should provide methods for built-in OSes" do
11
- os = OS.linux
12
+ it "should provide methods for built-in described_classes" do
13
+ os = described_class.linux
12
14
 
13
- os.name.should == 'Linux'
15
+ expect(os.name).to eq('Linux')
14
16
  end
15
17
 
16
- it "should provide methods for creating OSes with versions" do
17
- os = OS.linux('2.6.11')
18
+ it "should provide methods for creating described_classes with versions" do
19
+ os = described_class.linux(version)
18
20
 
19
- os.version.should == '2.6.11'
21
+ expect(os.version).to eq(version)
20
22
  end
21
23
  end
22
24
 
23
- it "should require a name" do
24
- os = OS.new
25
- os.should_not be_valid
25
+ describe "validations" do
26
+ it "should require a name" do
27
+ os = described_class.new
28
+ expect(os).not_to be_valid
26
29
 
27
- os.name = 'test'
28
- os.should be_valid
30
+ os.name = 'test'
31
+ expect(os).to be_valid
32
+ end
29
33
  end
30
34
 
31
35
  describe "#to_s" do
32
36
  it "should convert both the name and version" do
33
- os = OS.new(:name => 'Linux', :version => '2.6.23')
34
-
35
- os.to_s.should == 'Linux 2.6.23'
37
+ expect(subject.to_s).to eq("#{name} #{version}")
36
38
  end
37
39
 
38
- it "should convert just the name if there is no version" do
39
- os = OS.new(:name => 'Linux')
40
+ context "without a version" do
41
+ subject { described_class.new(:name => name) }
40
42
 
41
- os.to_s.should == os.name
43
+ it "should convert just the name if there is no version" do
44
+ expect(subject.to_s).to eq(name)
45
+ end
42
46
  end
43
47
  end
44
48
  end
@@ -1,14 +1,20 @@
1
1
  require 'spec_helper'
2
+
2
3
  require 'ronin/password'
3
4
 
4
5
  describe Password do
5
6
  let(:password) { 'secret' }
6
- subject { Password.new(:clear_text => password) }
7
7
 
8
- it "should require a clear-text password" do
9
- pass = Password.new
8
+ subject { described_class.new(:clear_text => password) }
9
+
10
+ describe "validations" do
11
+ it "should require a clear-text password" do
12
+ pass = described_class.new
13
+ expect(pass).not_to be_valid
10
14
 
11
- pass.should_not be_valid
15
+ pass.clear_text = password
16
+ expect(pass).to be_valid
17
+ end
12
18
  end
13
19
 
14
20
  describe "#digest" do
@@ -17,23 +23,25 @@ describe Password do
17
23
  it "should calculate the digest of the password" do
18
24
  digest = subject.digest(:sha1)
19
25
 
20
- digest.should == Digest::SHA1.hexdigest(password)
26
+ expect(digest).to eq(Digest::SHA1.hexdigest(password))
21
27
  end
22
28
 
23
29
  it "should calculate the digest of the password and prepended salt" do
24
30
  digest = subject.digest(:sha1, :prepend_salt => salt)
25
31
 
26
- digest.should == Digest::SHA1.hexdigest(salt + password)
32
+ expect(digest).to eq(Digest::SHA1.hexdigest(salt + password))
27
33
  end
28
34
 
29
35
  it "should calculate the digest of the password and appended salt" do
30
36
  digest = subject.digest(:sha1, :append_salt => salt)
31
37
 
32
- digest.should == Digest::SHA1.hexdigest(password + salt)
38
+ expect(digest).to eq(Digest::SHA1.hexdigest(password + salt))
33
39
  end
34
40
  end
35
41
 
36
- it "should be convertable to a String" do
37
- subject.to_s.should == password
42
+ describe "#to_s" do
43
+ it "should include the password" do
44
+ expect(subject.to_s).to eq(password)
45
+ end
38
46
  end
39
47
  end