ronin-db-activerecord 0.1.0.beta1 → 0.1.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -0
  3. data/.yardopts +1 -1
  4. data/README.md +2 -1
  5. data/db/migrate/0001_create_ronin_ip_address_mac_addresses_table.rb +1 -1
  6. data/db/migrate/0002_create_ronin_vulnerabilities_table.rb +1 -1
  7. data/db/migrate/0003_create_ronin_url_schemes_table.rb +1 -1
  8. data/db/migrate/0004_create_ronin_url_query_param_names_table.rb +1 -1
  9. data/db/migrate/0005_create_ronin_user_names_table.rb +1 -1
  10. data/db/migrate/0006_create_ronin_software_vendors_table.rb +1 -1
  11. data/db/migrate/0007_create_ronin_advisories_table.rb +1 -1
  12. data/db/migrate/0008_create_ronin_host_name_ip_addresses_table.rb +1 -1
  13. data/db/migrate/0009_create_ronin_host_names_table.rb +1 -1
  14. data/db/migrate/0010_create_ronin_arches_table.rb +1 -1
  15. data/db/migrate/0011_create_ronin_email_addresses_table.rb +1 -1
  16. data/db/migrate/0012_create_ronin_oses_table.rb +1 -1
  17. data/db/migrate/0013_create_ronin_organizations_table.rb +1 -1
  18. data/db/migrate/0014_create_ronin_ip_addresses_table.rb +1 -1
  19. data/db/migrate/0015_create_ronin_os_guesses_table.rb +1 -1
  20. data/db/migrate/0016_create_ronin_url_query_params_table.rb +1 -1
  21. data/db/migrate/0017_create_ronin_passwords_table.rb +1 -1
  22. data/db/migrate/0018_create_ronin_open_ports_table.rb +1 -1
  23. data/db/migrate/0019_create_ronin_urls_table.rb +1 -1
  24. data/db/migrate/0020_create_ronin_softwares_table.rb +1 -1
  25. data/db/migrate/0021_create_ronin_mac_addresses_table.rb +1 -1
  26. data/db/migrate/0022_create_ronin_countries_table.rb +1 -1
  27. data/db/migrate/0023_create_ronin_services_table.rb +1 -1
  28. data/db/migrate/0024_create_ronin_credentials_table.rb +1 -1
  29. data/db/migrate/0025_create_ronin_ports_table.rb +1 -1
  30. data/db/migrate/0026_create_ronin_asns_table.rb +1 -1
  31. data/db/migrate/0027_create_ronin_http_query_param_names_table.rb +1 -1
  32. data/db/migrate/0028_create_ronin_http_query_params_table.rb +1 -1
  33. data/db/migrate/0029_create_ronin_http_header_names_table.rb +1 -1
  34. data/db/migrate/0030_create_ronin_http_request_headers_table.rb +1 -1
  35. data/db/migrate/0031_create_ronin_http_response_headers_table.rb +1 -1
  36. data/db/migrate/0032_create_ronin_http_requests_table.rb +1 -1
  37. data/db/migrate/0033_create_ronin_http_responses_table.rb +1 -1
  38. data/db/migrate/0034_create_ronin_service_credentials_table.rb +1 -1
  39. data/db/migrate/0035_create_ronin_web_credentials_table.rb +1 -1
  40. data/gemspec.yml +3 -3
  41. data/lib/ronin/db/address.rb +1 -1
  42. data/lib/ronin/db/advisory.rb +1 -1
  43. data/lib/ronin/db/arch.rb +1 -1
  44. data/lib/ronin/db/asn.rb +1 -1
  45. data/lib/ronin/db/credential.rb +1 -1
  46. data/lib/ronin/db/email_address.rb +1 -1
  47. data/lib/ronin/db/host_name.rb +1 -1
  48. data/lib/ronin/db/host_name_ip_address.rb +1 -1
  49. data/lib/ronin/db/http_header_name.rb +1 -1
  50. data/lib/ronin/db/http_query_param.rb +1 -1
  51. data/lib/ronin/db/http_query_param_name.rb +1 -1
  52. data/lib/ronin/db/http_request.rb +1 -1
  53. data/lib/ronin/db/http_request_header.rb +1 -1
  54. data/lib/ronin/db/http_response.rb +1 -1
  55. data/lib/ronin/db/http_response_header.rb +1 -1
  56. data/lib/ronin/db/ip_address.rb +1 -1
  57. data/lib/ronin/db/ip_address_mac_address.rb +1 -1
  58. data/lib/ronin/db/mac_address.rb +1 -1
  59. data/lib/ronin/db/migrations.rb +1 -1
  60. data/lib/ronin/db/model/has_name.rb +1 -1
  61. data/lib/ronin/db/model/has_unique_name.rb +1 -1
  62. data/lib/ronin/db/model/importable.rb +1 -1
  63. data/lib/ronin/db/model/last_scanned_at.rb +1 -1
  64. data/lib/ronin/db/model.rb +1 -1
  65. data/lib/ronin/db/models.rb +1 -1
  66. data/lib/ronin/db/open_port.rb +1 -1
  67. data/lib/ronin/db/organization.rb +1 -1
  68. data/lib/ronin/db/os.rb +1 -1
  69. data/lib/ronin/db/os_guess.rb +1 -1
  70. data/lib/ronin/db/password.rb +1 -1
  71. data/lib/ronin/db/port.rb +1 -1
  72. data/lib/ronin/db/schema_migration.rb +1 -1
  73. data/lib/ronin/db/service.rb +1 -1
  74. data/lib/ronin/db/service_credential.rb +1 -1
  75. data/lib/ronin/db/software.rb +1 -1
  76. data/lib/ronin/db/software_vendor.rb +1 -1
  77. data/lib/ronin/db/url.rb +1 -1
  78. data/lib/ronin/db/url_query_param.rb +1 -1
  79. data/lib/ronin/db/url_query_param_name.rb +1 -1
  80. data/lib/ronin/db/url_scheme.rb +1 -1
  81. data/lib/ronin/db/user_name.rb +1 -1
  82. data/lib/ronin/db/vulnerability.rb +1 -1
  83. data/lib/ronin/db/web_credential.rb +1 -1
  84. data/ronin-db-activerecord.gemspec +2 -1
  85. metadata +5 -87
  86. data/lib/ronin/db/root.rb +0 -28
  87. data/spec/advisory_spec.rb +0 -277
  88. data/spec/arch_spec.rb +0 -228
  89. data/spec/asn_spec.rb +0 -504
  90. data/spec/credential_spec.rb +0 -362
  91. data/spec/email_address_spec.rb +0 -372
  92. data/spec/host_name_ip_address_spec.rb +0 -8
  93. data/spec/host_name_spec.rb +0 -207
  94. data/spec/http_header_name_spec.rb +0 -25
  95. data/spec/http_query_param_name_spec.rb +0 -25
  96. data/spec/http_query_param_spec.rb +0 -104
  97. data/spec/http_request_header_spec.rb +0 -72
  98. data/spec/http_request_spec.rb +0 -168
  99. data/spec/http_response_header_spec.rb +0 -74
  100. data/spec/http_response_spec.rb +0 -103
  101. data/spec/ip_address_mac_addresses_spec.rb +0 -8
  102. data/spec/ip_address_spec.rb +0 -386
  103. data/spec/mac_address_spec.rb +0 -67
  104. data/spec/migrations_spec.rb +0 -122
  105. data/spec/model/has_name_spec.rb +0 -65
  106. data/spec/model/has_unique_name_spec.rb +0 -61
  107. data/spec/model/importable_spec.rb +0 -105
  108. data/spec/models_spec.rb +0 -60
  109. data/spec/open_port_spec.rb +0 -87
  110. data/spec/organization_spec.rb +0 -10
  111. data/spec/os_guess_spec.rb +0 -43
  112. data/spec/os_spec.rb +0 -114
  113. data/spec/password_spec.rb +0 -81
  114. data/spec/port_spec.rb +0 -102
  115. data/spec/schema_migration_spec.rb +0 -8
  116. data/spec/service_credential_spec.rb +0 -43
  117. data/spec/service_spec.rb +0 -39
  118. data/spec/software_spec.rb +0 -76
  119. data/spec/software_vendor_spec.rb +0 -33
  120. data/spec/spec_helper.rb +0 -13
  121. data/spec/url_query_param_name_spec.rb +0 -25
  122. data/spec/url_query_param_spec.rb +0 -110
  123. data/spec/url_scheme_spec.rb +0 -39
  124. data/spec/url_spec.rb +0 -951
  125. data/spec/user_name_spec.rb +0 -54
  126. data/spec/vulnerability_spec.rb +0 -8
  127. data/spec/web_credential_spec.rb +0 -72
@@ -1,372 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/db/email_address'
3
-
4
- describe Ronin::DB::EmailAddress do
5
- it "must use the 'ronin_email_addresses' table" do
6
- expect(described_class.table_name).to eq('ronin_email_addresses')
7
- end
8
-
9
- let(:user) { 'joe' }
10
- let(:host) { 'example.com' }
11
- let(:address) { "#{user}@#{host}" }
12
-
13
- let(:user_name) { Ronin::DB::UserName.new(name: user) }
14
- let(:host_name) { Ronin::DB::HostName.new(name: host) }
15
-
16
- subject do
17
- described_class.new(
18
- user_name: user_name,
19
- host_name: host_name
20
- )
21
- end
22
-
23
- describe "validations" do
24
- describe "address" do
25
- it "must require an email address" do
26
- email_address = described_class.new(
27
- user_name: user_name,
28
- host_name: host_name
29
- )
30
- expect(email_address).to_not be_valid
31
- expect(email_address.errors[:address]).to include(
32
- "can't be blank"
33
- )
34
-
35
- email_address = described_class.new(
36
- address: address,
37
- user_name: user_name,
38
- host_name: host_name
39
- )
40
- expect(email_address).to be_valid
41
- end
42
-
43
- it "must require a valid email address" do
44
- email_address = described_class.new(
45
- address: "foo AT bar DOT com",
46
- user_name: user_name,
47
- host_name: host_name
48
- )
49
- expect(email_address).to_not be_valid
50
- expect(email_address.errors[:address]).to eq(
51
- ["Must be a valid email address"]
52
- )
53
-
54
- email_address = described_class.new(
55
- address: address,
56
- user_name: user_name,
57
- host_name: host_name
58
- )
59
- expect(email_address).to be_valid
60
- end
61
-
62
- it "must not allow email addresses longer than 320 characters" do
63
- email_address = described_class.new(
64
- address: ('a' * 320) + "@example.com",
65
- user_name: user_name,
66
- host_name: host_name
67
- )
68
- expect(email_address).to_not be_valid
69
- expect(email_address.errors[:address]).to eq(
70
- ["is too long (maximum is 320 characters)"]
71
- )
72
-
73
- email_address = described_class.new(
74
- address: address,
75
- user_name: user_name,
76
- host_name: host_name
77
- )
78
- expect(email_address).to be_valid
79
- end
80
-
81
- it "must require a unique email address" do
82
- user_name.save
83
- host_name.save
84
-
85
- email_address = described_class.create(
86
- address: address,
87
- user_name: user_name,
88
- host_name: host_name
89
- )
90
- expect(email_address).to be_valid
91
-
92
- email_address = described_class.new(
93
- address: address,
94
- user_name: user_name,
95
- host_name: host_name
96
- )
97
-
98
- expect(email_address).to_not be_valid
99
- expect(email_address.errors[:address]).to eq(
100
- ["has already been taken"]
101
- )
102
-
103
- described_class.destroy_all
104
- user_name.destroy
105
- host_name.destroy
106
- end
107
- end
108
-
109
- describe "host_name" do
110
- it "must require a host_name" do
111
- email_address = described_class.new(
112
- address: address,
113
- user_name: user_name
114
- )
115
- expect(email_address).to_not be_valid
116
- expect(email_address.errors[:host_name]).to include(
117
- "must exist"
118
- )
119
-
120
- email_address = described_class.new(
121
- address: address,
122
- user_name: user_name,
123
- host_name: host_name
124
- )
125
- expect(email_address).to be_valid
126
- end
127
- end
128
-
129
- describe "user_name" do
130
- it "must require a user_name" do
131
- email_address = described_class.new(
132
- address: address,
133
- host_name: host_name
134
- )
135
- expect(email_address).to_not be_valid
136
- expect(email_address.errors[:user_name]).to include(
137
- "must exist"
138
- )
139
-
140
- email_address = described_class.new(
141
- address: address,
142
- user_name: user_name,
143
- host_name: host_name
144
- )
145
- expect(email_address).to be_valid
146
- end
147
-
148
- it "must require a unique combination of host_name and user_name" do
149
- user_name.save
150
- host_name.save
151
-
152
- email_address = described_class.create(
153
- address: address,
154
- user_name: user_name,
155
- host_name: host_name
156
- )
157
- expect(email_address).to be_valid
158
-
159
- email_address = described_class.new(
160
- address: address,
161
- user_name: user_name,
162
- host_name: host_name
163
- )
164
- expect(email_address).to_not be_valid
165
- expect(email_address.errors[:user_name]).to eq(
166
- ["has already been taken"]
167
- )
168
-
169
- described_class.destroy_all
170
- user_name.destroy
171
- host_name.destroy
172
- end
173
- end
174
- end
175
-
176
- describe ".with_host_name" do
177
- subject { described_class }
178
-
179
- let(:user_name) { Ronin::DB::UserName.create(name: user) }
180
- let(:host_name) { Ronin::DB::HostName.create(name: host) }
181
-
182
- before do
183
- email_address = described_class.create(
184
- address: address,
185
- user_name: user_name,
186
- host_name: host_name
187
- )
188
- end
189
-
190
- it "must find the #{described_class} with the associated host name" do
191
- email_address = subject.with_host_name(host).first
192
-
193
- expect(email_address).to be_kind_of(described_class)
194
- expect(email_address.host_name.name).to eq(host)
195
- end
196
-
197
- after do
198
- described_class.destroy_all
199
- user_name.destroy
200
- host_name.destroy
201
- end
202
- end
203
-
204
- describe ".with_ip_address" do
205
- subject { described_class }
206
-
207
- let(:user_name) { Ronin::DB::UserName.create(name: user) }
208
- let(:host_name) { Ronin::DB::HostName.create(name: host) }
209
-
210
- let(:ip) { '93.184.216.34' }
211
- let(:ip_address) { Ronin::DB::IPAddress.create(address: ip) }
212
-
213
- before do
214
- email_address = described_class.create(
215
- address: address,
216
- user_name: user_name,
217
- host_name: host_name
218
- )
219
- email_address.host_name.ip_addresses << ip_address
220
- end
221
-
222
- it "must find the #{described_class} with the associated IP address" do
223
- email_address = subject.with_ip_address(ip).first
224
-
225
- expect(email_address).to be_kind_of(described_class)
226
- expect(email_address.ip_addresses.first.address).to eq(ip)
227
- end
228
-
229
- after do
230
- described_class.destroy_all
231
- ip_address.destroy
232
- user_name.destroy
233
- host_name.destroy
234
- end
235
- end
236
-
237
- describe ".with_user_name" do
238
- subject { described_class }
239
-
240
- let(:user_name) { Ronin::DB::UserName.create(name: user) }
241
- let(:host_name) { Ronin::DB::HostName.create(name: host) }
242
-
243
- before do
244
- email_address = described_class.create(
245
- address: address,
246
- user_name: user_name,
247
- host_name: host_name
248
- )
249
- end
250
-
251
- it "must find the #{described_class} with the associated user name" do
252
- email_address = subject.with_user_name(user).first
253
-
254
- expect(email_address).to be_kind_of(described_class)
255
- expect(email_address.user_name.name).to eq(user)
256
- end
257
-
258
- after do
259
- described_class.destroy_all
260
- user_name.destroy
261
- host_name.destroy
262
- end
263
- end
264
-
265
- describe ".lookup" do
266
- let(:user_name) { Ronin::DB::UserName.create(name: user) }
267
- let(:host_name) { Ronin::DB::HostName.create(name: host) }
268
-
269
- before do
270
- described_class.create(
271
- address: 'other_user1@other_host1.com',
272
- user_name: Ronin::DB::UserName.create(name: 'other_user1'),
273
- host_name: Ronin::DB::HostName.create(name: 'other_host1')
274
- )
275
-
276
- described_class.create(
277
- address: address,
278
- user_name: user_name,
279
- host_name: host_name
280
- )
281
-
282
- described_class.create(
283
- address: 'other_user2@other_host2.com',
284
- user_name: Ronin::DB::UserName.create(name: 'other_user2'),
285
- host_name: Ronin::DB::HostName.create(name: 'other_host2')
286
- )
287
- end
288
-
289
- it "must query the #{described_class} with the given address" do
290
- email_address = described_class.lookup(address)
291
-
292
- expect(email_address.address).to eq(address)
293
- end
294
-
295
- after do
296
- described_class.destroy_all
297
- user_name.destroy
298
- host_name.destroy
299
- end
300
- end
301
-
302
- describe ".import" do
303
- context "when given a valid email address" do
304
- subject { described_class.import(address) }
305
-
306
- it "must parse and import the email address" do
307
- expect(subject.user_name.name).to eq(user)
308
- expect(subject.host_name.name).to eq(host)
309
- end
310
-
311
- after do
312
- subject.destroy
313
- subject.user_name.destroy
314
- subject.host_name.destroy
315
- end
316
- end
317
-
318
- context "when the email address does not have a user name" do
319
- subject { described_class }
320
-
321
- let(:address) { "@#{host}" }
322
-
323
- it do
324
- expect {
325
- subject.import(address)
326
- }.to raise_error(ArgumentError,"email address #{address.inspect} must have a user name")
327
- end
328
- end
329
-
330
- context "when the email address does not have a host name" do
331
- subject { described_class }
332
-
333
- let(:address) { "#{user}@" }
334
-
335
- it do
336
- expect {
337
- subject.import(address)
338
- }.to raise_error(ArgumentError,"email address #{address.inspect} must have a host name")
339
- end
340
- end
341
-
342
- context "when the email address contains spaces" do
343
- subject { described_class }
344
-
345
- let(:address) { "#{user} @ #{host}" }
346
-
347
- it do
348
- expect {
349
- subject.import(address)
350
- }.to raise_error(ArgumentError,"email address #{address.inspect} must not contain spaces")
351
- end
352
- end
353
- end
354
-
355
- describe "#user" do
356
- it "must return the user-name" do
357
- expect(subject.user).to eq(user)
358
- end
359
- end
360
-
361
- describe "#host" do
362
- it "must return the host-name" do
363
- expect(subject.host).to eq(host)
364
- end
365
- end
366
-
367
- describe "#to_s" do
368
- it "should include the email address" do
369
- expect(subject.to_s).to eq(address)
370
- end
371
- end
372
- end
@@ -1,8 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/db/host_name_ip_address'
3
-
4
- describe Ronin::DB::HostNameIPAddress do
5
- it "must use the 'ronin_host_name_ip_addresses' table" do
6
- expect(described_class.table_name).to eq('ronin_host_name_ip_addresses')
7
- end
8
- end
@@ -1,207 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/db/host_name'
3
-
4
- describe Ronin::DB::HostName do
5
- it "must use the 'ronin_host_names' table" do
6
- expect(described_class.table_name).to eq('ronin_host_names')
7
- end
8
-
9
- it "must include Ronin::DB::Model::LastScannedat" do
10
- expect(described_class).to include(Ronin::DB::Model::LastScannedAt)
11
- end
12
-
13
- let(:name) { 'example.com' }
14
- let(:address) { '93.184.216.34' }
15
-
16
- describe "validations" do
17
- describe "name" do
18
- it "require an host name" do
19
- host_name = described_class.new
20
- expect(host_name).to_not be_valid
21
-
22
- host_name = described_class.new(name: name)
23
- expect(host_name).to be_valid
24
- end
25
-
26
- it "must require a unique name" do
27
- described_class.create(name: name)
28
-
29
- host_name = described_class.new(name: name)
30
- expect(host_name).to_not be_valid
31
-
32
- described_class.destroy_all
33
- end
34
- end
35
- end
36
-
37
- describe ".with_ip_address" do
38
- subject { described_class }
39
-
40
- let(:name) { 'example.com' }
41
- let(:address) { '93.184.216.34' }
42
-
43
- before do
44
- host = subject.create(name: name)
45
- host.ip_addresses.create(address: address)
46
- end
47
-
48
- it "must find the #{described_class} with the associated IP address" do
49
- host = subject.with_ip_address([address]).first
50
-
51
- expect(host).to be_kind_of(described_class)
52
- expect(host.name).to eq(name)
53
- expect(host.ip_addresses[0].address).to eq(address)
54
- end
55
-
56
- after do
57
- Ronin::DB::HostNameIPAddress.destroy_all
58
- Ronin::DB::IPAddress.destroy_all
59
- Ronin::DB::HostName.destroy_all
60
- end
61
- end
62
-
63
- describe ".with_port_number" do
64
- subject { described_class }
65
-
66
- let(:port1) { 80 }
67
- let(:port2) { 443 }
68
- let(:ports) { [port1, port2] }
69
-
70
- before do
71
- host = described_class.create(name: name)
72
- ip_address = host.ip_addresses.create(address: address)
73
-
74
- ip_address.ports.create(protocol: :tcp, number: port1)
75
- ip_address.ports.create(protocol: :tcp, number: port2)
76
- end
77
-
78
- it "must find the #{described_class} with the associated port number" do
79
- host = subject.with_port_number(port2).first
80
-
81
- expect(host).to be_kind_of(described_class)
82
- expect(host.name).to eq(name)
83
- expect(host.ports.map(&:number)).to include(port2)
84
- end
85
-
86
- context "when given an Array of port numbers" do
87
- it "must find the #{described_class} with the associated port numbers" do
88
- host = subject.with_port_number(ports).first
89
-
90
- expect(host).to be_kind_of(described_class)
91
- expect(host.name).to eq(name)
92
- expect(host.ports[0].number).to eq(port1)
93
- expect(host.ports[1].number).to eq(port2)
94
- end
95
- end
96
-
97
- after do
98
- Ronin::DB::OpenPort.destroy_all
99
- Ronin::DB::Port.destroy_all
100
- Ronin::DB::HostNameIPAddress.destroy_all
101
- Ronin::DB::IPAddress.destroy_all
102
- Ronin::DB::HostName.destroy_all
103
- end
104
- end
105
-
106
- describe ".with_tld" do
107
- subject { described_class }
108
-
109
- let(:tld) { 'co.uk' }
110
- let(:domain) { "example.#{tld}" }
111
-
112
- before do
113
- subject.create(name: domain)
114
- end
115
-
116
- it "must find the #{described_class} with the given TLD" do
117
- host_name = subject.with_tld(tld).first
118
-
119
- expect(host_name).to be_kind_of(described_class)
120
- expect(host_name.name).to eq(domain)
121
- end
122
-
123
- after do
124
- described_class.destroy_all
125
- end
126
- end
127
-
128
- describe ".with_domain" do
129
- subject { described_class }
130
-
131
- context "when the exact domain exists in the database" do
132
- let(:domain) { 'example.com' }
133
-
134
- before do
135
- subject.create(name: domain)
136
- end
137
-
138
- it "must query the domain" do
139
- host = subject.with_domain(domain).first
140
-
141
- expect(host).to be_kind_of(described_class)
142
- expect(host.name).to eq(domain)
143
- end
144
-
145
- after { subject.destroy_all }
146
-
147
- context "when other sub-domain names exist in the database" do
148
- let(:sub_domain1) { 'www.example.com' }
149
- let(:sub_domain2) { 'mail.example.com' }
150
-
151
- before do
152
- subject.create(name: sub_domain1)
153
- subject.create(name: sub_domain2)
154
- end
155
-
156
- it "must query the domain and sub-domain names" do
157
- hosts = subject.with_domain(domain)
158
-
159
- expect(hosts[0]).to be_kind_of(described_class)
160
- expect(hosts[0].name).to eq(domain)
161
-
162
- expect(hosts[1]).to be_kind_of(described_class)
163
- expect(hosts[1].name).to eq(sub_domain1)
164
-
165
- expect(hosts[2]).to be_kind_of(described_class)
166
- expect(hosts[2].name).to eq(sub_domain2)
167
- end
168
-
169
- after { subject.destroy_all }
170
- end
171
- end
172
- end
173
-
174
- describe ".lookup" do
175
- before do
176
- described_class.create(name: 'other.host1.com')
177
- described_class.create(name: name)
178
- described_class.create(name: 'other.host2.com')
179
- end
180
-
181
- it "must query the #{described_class} with the matching name" do
182
- host_name = described_class.lookup(name)
183
-
184
- expect(host_name).to be_kind_of(described_class)
185
- expect(host_name.name).to eq(name)
186
- end
187
-
188
- after { described_class.destroy_all }
189
- end
190
-
191
- describe ".import" do
192
- let(:name) { 'example.com' }
193
-
194
- subject { described_class.import(name) }
195
-
196
- it "must import the host name and return a new #{described_class} record" do
197
- expect(subject).to be_kind_of(described_class)
198
- expect(subject.id).to_not be(nil)
199
- expect(subject.name).to eq(name)
200
- end
201
-
202
- after { described_class.destroy_all }
203
- end
204
-
205
- describe "#recent_ip_address" do
206
- end
207
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/db/http_header_name'
3
-
4
- describe Ronin::DB::HTTPHeaderName do
5
- it "must use the 'ronin_http_header_names' table" do
6
- expect(described_class.table_name).to eq('ronin_http_header_names')
7
- end
8
-
9
- let(:name) { 'foo' }
10
-
11
- describe "validations" do
12
- describe "name" do
13
- it "should require name attribute" do
14
- http_header_name = described_class.new
15
- expect(http_header_name).to_not be_valid
16
- expect(http_header_name.errors[:name]).to eq(
17
- ["can't be blank"]
18
- )
19
-
20
- http_header_name = described_class.new(name: name)
21
- expect(http_header_name).to be_valid
22
- end
23
- end
24
- end
25
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/db/http_query_param_name'
3
-
4
- describe Ronin::DB::HTTPQueryParamName do
5
- it "must use the 'ronin_http_query_param_names' table" do
6
- expect(described_class.table_name).to eq('ronin_http_query_param_names')
7
- end
8
-
9
- let(:name) { 'foo' }
10
-
11
- describe "validations" do
12
- describe "name" do
13
- it "should require name attribute" do
14
- http_query_param_name = described_class.new
15
- expect(http_query_param_name).to_not be_valid
16
- expect(http_query_param_name.errors[:name]).to eq(
17
- ["can't be blank"]
18
- )
19
-
20
- http_query_param_name = described_class.new(name: name)
21
- expect(http_query_param_name).to be_valid
22
- end
23
- end
24
- end
25
- end