active_triples-local_name 0.1.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.coveralls.yml +1 -0
- data/.gitignore +24 -4
- data/.travis.yml +1 -1
- data/Gemfile +0 -4
- data/README.md +3 -0
- data/active_triples-local_name.gemspec +3 -3
- data/lib/active_triples/local_name/minter.rb +4 -0
- data/lib/active_triples/local_name/version.rb +1 -1
- data/spec/active_triples/local_name/minter_spec.rb +118 -15
- data/spec/spec_helper.rb +3 -0
- metadata +32 -4
- data/spec/support/active_model_lint.rb +0 -81
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OThlYTNlODZlOGMwNTBiZGE0ZjYwOWZiNDE1Njc2NjViNjljNjgyNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGRlMjgyMmE1ZDMxOGRmN2ZjODA2MmNlYTcwYTBlN2FjMjc3NjFmNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmY4NjEzZDZmZTM0OWRjNGEwMTZmZTc2NzQ2YTMzZDAwZjYzOWFmZDljMWMw
|
10
|
+
ZDAwNWM0OGQ4ODU4MWVjNmRmNzk1NTU4MmJkNTVjOWRiM2VmMDdkMjE5ODRk
|
11
|
+
MGI1ODAxYmE2NDE3YTQ4YTRjZjk2YTNkNzJkNjVlYzllZGY4YzE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Mjc1ZTZkZGQxYTQyZTk2ZTEyMzBmMGI1NTA2ZmRjNTM1NDZkYjIxZDIzYjIy
|
14
|
+
ODg2ZjgzYmYwOGEyZTRiN2UxZGVhYWI3ODg4YTFjOWFkNmY2MzBhOTllOTRl
|
15
|
+
MWRlYzQwNTUwMmUxOWJkNWFmZWQyZjliYmM1YWU0NGQwMWM1MGQ=
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
CHANGED
@@ -1,7 +1,27 @@
|
|
1
|
-
.bundle/
|
2
1
|
log/*.log
|
3
|
-
pkg/
|
4
|
-
Gemfile.lock
|
5
|
-
tmp/*
|
6
2
|
.sass-cache
|
3
|
+
*.gem
|
4
|
+
*.rbc
|
5
|
+
.bundle
|
6
|
+
.config
|
7
|
+
.yardoc
|
8
|
+
Gemfile.lock
|
9
|
+
InstalledFiles
|
10
|
+
_yardoc
|
11
|
+
coverage
|
12
|
+
doc/
|
13
|
+
lib/bundler/man
|
14
|
+
pkg
|
15
|
+
rdoc
|
16
|
+
spec/reports
|
17
|
+
test/tmp
|
18
|
+
test/version_tmp
|
19
|
+
tmp
|
20
|
+
*.bundle
|
21
|
+
*.so
|
22
|
+
*.o
|
23
|
+
*.a
|
24
|
+
mkmf.log
|
7
25
|
.idea
|
26
|
+
.ruby-gemset
|
27
|
+
.ruby-version
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -2,7 +2,3 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
# GETTING FROM GEMFILE UNTIL ActiveTriples master CODE IS RELEASED (>0.4.0), THEN MOVE THIS BACK TO *.gemspec FILE
|
6
|
-
# Use active-triple for handling of triple persistence
|
7
|
-
gem 'active-triples', :git => 'git@github.com:no-reply/ActiveTriples.git', :branch => 'master'
|
8
|
-
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# ActiveTriples::LocalName
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/ActiveTriples/active_triples-local_name.png?branch=master)](https://travis-ci.org/ActiveTriples/active_triples-local_name)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/ActiveTriples/active_triples-local_name/badge.png?branch=master)](https://coveralls.io/r/ActiveTriples/active_triples-local_name?branch=master)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/active_triples-local_name.svg)](http://badge.fury.io/rb/active_triples-local_name)
|
3
6
|
|
4
7
|
Provides utilities for working with local names under the [ActiveTriples](https://github.com/ActiveTriples/ActiveTriples)
|
5
8
|
framework. Includes a default implementation of a local name minter.
|
@@ -7,21 +7,21 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = ActiveTriples::LocalName::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["E. Lynette Rayle"]
|
10
|
-
s.homepage = 'https://github.com/
|
10
|
+
s.homepage = 'https://github.com/ActiveTriples/active_triples-local_name'
|
11
11
|
s.email = 'elr37@cornell.edu'
|
12
12
|
s.summary = %q{Local name minter for ActiveTriples based resources.}
|
13
13
|
s.description = %q{active_triples-local_name provides a standard interface and default implementation for a minter of the local name portion of a URI.}
|
14
14
|
s.license = "APACHE2"
|
15
15
|
s.required_ruby_version = '>= 1.9.3'
|
16
16
|
|
17
|
-
|
18
|
-
# s.add_dependency('active-triples', '~> 0.4')
|
17
|
+
s.add_dependency('active-triples', '~> 0.5')
|
19
18
|
|
20
19
|
s.add_dependency('deprecation', '~> 0.1')
|
21
20
|
s.add_dependency('activesupport', '>= 3.0.0')
|
22
21
|
|
23
22
|
s.add_development_dependency('rdoc')
|
24
23
|
s.add_development_dependency('rspec')
|
24
|
+
s.add_development_dependency('coveralls')
|
25
25
|
s.add_development_dependency('guard-rspec')
|
26
26
|
|
27
27
|
s.files = `git ls-files`.split("\n")
|
@@ -26,6 +26,8 @@ module ActiveTriples
|
|
26
26
|
# @raise [Exception] if for_class does not have base_uri configured
|
27
27
|
# @raise [Exception] if an available local name is not found in the maximum allowed tries.
|
28
28
|
#
|
29
|
+
# @note See README for examples passing in minter block.
|
30
|
+
#
|
29
31
|
# @TODO This is inefficient if max_tries is large. Could try
|
30
32
|
# multi-threading. When using the default_minter included
|
31
33
|
# in this class, it is unlikely to be a problem and should
|
@@ -63,6 +65,8 @@ module ActiveTriples
|
|
63
65
|
# numeric as the first character. Pass in an alpha character as <tt>:prefix</tt> to enforce this best
|
64
66
|
# practice.
|
65
67
|
#
|
68
|
+
# @note See README for example overriding default minter.
|
69
|
+
#
|
66
70
|
# @return [String] a uuid
|
67
71
|
def self.default_minter( *options )
|
68
72
|
prefix = options[0][:prefix] if ! options.empty? && options[0].is_a?(Hash) && options[0].key?(:prefix)
|
@@ -81,10 +81,55 @@ describe ActiveTriples::LocalName::Minter do
|
|
81
81
|
ActiveTriples::Repositories.clear_repositories!
|
82
82
|
end
|
83
83
|
|
84
|
-
context "when
|
85
|
-
|
86
|
-
|
84
|
+
context "when one or more arguments are invalid" do
|
85
|
+
# def self.generate_local_name(for_class, max_tries=10, *minter_args, &minter_block)
|
86
|
+
|
87
|
+
context "and all arguments are missing" do
|
88
|
+
it "should raise error" do
|
89
|
+
# NOTE: ruby < 2 puts out (0 for 1); ruby >= 2 puts out (0 for 1+)
|
90
|
+
expect{ ActiveTriples::LocalName::Minter.generate_local_name() }.
|
91
|
+
to raise_error(ArgumentError, /wrong number of arguments \(0 for 1\+?\)/)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context "and max_tries is negative" do
|
96
|
+
it "should raise error" do
|
97
|
+
expect{ ActiveTriples::LocalName::Minter.generate_local_name(DummyResource,-1) }.
|
98
|
+
to raise_error(ArgumentError, 'Argument max_tries must be >= 1 if passed in')
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context "and class doesn't inherit from ActiveTriples::Resource" do
|
103
|
+
before do
|
104
|
+
class DummyNonResource
|
105
|
+
end
|
106
|
+
end
|
107
|
+
after do
|
108
|
+
Object.send(:remove_const, "DummyNonResource") if Object
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should raise error" do
|
112
|
+
expect{ ActiveTriples::LocalName::Minter.generate_local_name(DummyNonResource) }.
|
113
|
+
to raise_error(ArgumentError, 'Argument for_class must inherit from ActiveTriples::Resource')
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
context "and class doesn't have base_uri defined" do
|
119
|
+
it "should raise error" do
|
120
|
+
expect{ ActiveTriples::LocalName::Minter.generate_local_name(DummyResource) }.
|
121
|
+
to raise_error(RuntimeError, 'Requires base_uri to be defined in for_class.')
|
122
|
+
end
|
87
123
|
end
|
124
|
+
|
125
|
+
## TODO: Can't see how to test this. The test complains if I pass anything other than a Proc instead of complaining that the passing in thing isn't callable.
|
126
|
+
# context "block isn't callable" do
|
127
|
+
# it "should raise error" do
|
128
|
+
# x = "foo"
|
129
|
+
# expect{ ActiveTriples::LocalName::Minter.generate_local_name(DummyResourceWithBaseURI,10,{:prefix => 'a'},&x) }.
|
130
|
+
# to raise_error(ArgumentError, 'Invalid minter_block.')
|
131
|
+
# end
|
132
|
+
# end
|
88
133
|
end
|
89
134
|
|
90
135
|
context "when all IDs available" do
|
@@ -92,8 +137,8 @@ describe ActiveTriples::LocalName::Minter do
|
|
92
137
|
it "should generate an ID using default minter function" do
|
93
138
|
id = ActiveTriples::LocalName::Minter.generate_local_name(DummyResourceWithBaseURI)
|
94
139
|
expect(id).to be_kind_of String
|
95
|
-
expect(id.length).to
|
96
|
-
id.
|
140
|
+
expect(id.length).to eq 36
|
141
|
+
expect(id).to match /[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/
|
97
142
|
end
|
98
143
|
end
|
99
144
|
|
@@ -290,8 +335,8 @@ describe ActiveTriples::LocalName::Minter do
|
|
290
335
|
it "should generate a prefixed ID" do
|
291
336
|
id = ActiveTriples::LocalName::Minter.generate_local_name(DummyResourceWithBaseURI,10,{:prefix=>"s"})
|
292
337
|
expect(id).to be_kind_of String
|
293
|
-
expect(id.length).to
|
294
|
-
id.
|
338
|
+
expect(id.length).to eq 37
|
339
|
+
expect(id).to match /s[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/
|
295
340
|
end
|
296
341
|
end
|
297
342
|
|
@@ -299,8 +344,8 @@ describe ActiveTriples::LocalName::Minter do
|
|
299
344
|
it "should generate ID ignoring prefix" do
|
300
345
|
id = ActiveTriples::LocalName::Minter.generate_local_name(DummyResourceWithBaseURI,10,1)
|
301
346
|
expect(id).to be_kind_of String
|
302
|
-
expect(id.length).to
|
303
|
-
id.
|
347
|
+
expect(id.length).to eq 36
|
348
|
+
expect(id).to match /[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/
|
304
349
|
end
|
305
350
|
end
|
306
351
|
|
@@ -308,8 +353,8 @@ describe ActiveTriples::LocalName::Minter do
|
|
308
353
|
it "should generate ID ignoring prefix" do
|
309
354
|
id = ActiveTriples::LocalName::Minter.generate_local_name(DummyResourceWithBaseURI,10,{:prefix=>1.5})
|
310
355
|
expect(id).to be_kind_of String
|
311
|
-
expect(id.length).to
|
312
|
-
id.
|
356
|
+
expect(id.length).to eq 36
|
357
|
+
expect(id).to match /[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/
|
313
358
|
end
|
314
359
|
end
|
315
360
|
|
@@ -317,8 +362,8 @@ describe ActiveTriples::LocalName::Minter do
|
|
317
362
|
it "should generate ID ignoring prefix" do
|
318
363
|
id = ActiveTriples::LocalName::Minter.generate_local_name(DummyResourceWithBaseURI,10,{:prefix=>{"a"=>"b"}})
|
319
364
|
expect(id).to be_kind_of String
|
320
|
-
expect(id.length).to
|
321
|
-
id.
|
365
|
+
expect(id.length).to eq 36
|
366
|
+
expect(id).to match /[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/
|
322
367
|
end
|
323
368
|
end
|
324
369
|
|
@@ -326,11 +371,69 @@ describe ActiveTriples::LocalName::Minter do
|
|
326
371
|
it "should generate ID ignoring prefix" do
|
327
372
|
id = ActiveTriples::LocalName::Minter.generate_local_name(DummyResourceWithBaseURI,10,{:prefix=>[1,2,3]})
|
328
373
|
expect(id).to be_kind_of String
|
329
|
-
expect(id.length).to
|
330
|
-
id.
|
374
|
+
expect(id.length).to eq 36
|
375
|
+
expect(id).to match /[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/
|
331
376
|
end
|
332
377
|
end
|
333
378
|
end
|
334
379
|
|
335
380
|
end
|
381
|
+
|
382
|
+
describe "default_minter" do
|
383
|
+
context "when options are empty" do
|
384
|
+
it "creates a uuid" do
|
385
|
+
id = ActiveTriples::LocalName::Minter.default_minter
|
386
|
+
expect(id).to be_kind_of String
|
387
|
+
expect(id.length).to eq 36
|
388
|
+
expect(id).to match /[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
392
|
+
context "when options is passed a prefix" do
|
393
|
+
context "and prefix is string" do
|
394
|
+
it "should generate a prefixed ID" do
|
395
|
+
id = ActiveTriples::LocalName::Minter.default_minter({:prefix=>"s"})
|
396
|
+
expect(id).to be_kind_of String
|
397
|
+
expect(id.length).to eq 37
|
398
|
+
expect(id).to match /s[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/
|
399
|
+
end
|
400
|
+
end
|
401
|
+
|
402
|
+
context "and prefix is integer" do
|
403
|
+
it "should generate ID ignoring prefix" do
|
404
|
+
id = ActiveTriples::LocalName::Minter.default_minter({:prefix=>1})
|
405
|
+
expect(id).to be_kind_of String
|
406
|
+
expect(id.length).to eq 36
|
407
|
+
expect(id).to match /[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
context "and prefix is float" do
|
412
|
+
it "should generate ID ignoring prefix" do
|
413
|
+
id = ActiveTriples::LocalName::Minter.default_minter({:prefix=>1.5})
|
414
|
+
expect(id).to be_kind_of String
|
415
|
+
expect(id.length).to eq 36
|
416
|
+
expect(id).to match /[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
context "and prefix is hash" do
|
421
|
+
it "should generate ID ignoring prefix" do
|
422
|
+
id = ActiveTriples::LocalName::Minter.default_minter({:prefix=>{"a"=>"b"}})
|
423
|
+
expect(id).to be_kind_of String
|
424
|
+
expect(id.length).to eq 36
|
425
|
+
expect(id).to match /[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
context "and prefix is array" do
|
430
|
+
it "should generate ID ignoring prefix" do
|
431
|
+
id = ActiveTriples::LocalName::Minter.default_minter({:prefix=>[1,2,3]})
|
432
|
+
expect(id).to be_kind_of String
|
433
|
+
expect(id.length).to eq 36
|
434
|
+
expect(id).to match /[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|
438
|
+
end
|
336
439
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_triples-local_name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- E. Lynette Rayle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: active-triples
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.5'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: deprecation
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +80,20 @@ dependencies:
|
|
66
80
|
- - ! '>='
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: coveralls
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: guard-rspec
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,6 +117,7 @@ extra_rdoc_files:
|
|
89
117
|
- LICENSE
|
90
118
|
- README.md
|
91
119
|
files:
|
120
|
+
- .coveralls.yml
|
92
121
|
- .gitignore
|
93
122
|
- .travis.yml
|
94
123
|
- AUTHORS
|
@@ -102,8 +131,7 @@ files:
|
|
102
131
|
- lib/active_triples/local_name/version.rb
|
103
132
|
- spec/active_triples/local_name/minter_spec.rb
|
104
133
|
- spec/spec_helper.rb
|
105
|
-
|
106
|
-
homepage: https://github.com/no-reply/active_triples-local_name
|
134
|
+
homepage: https://github.com/ActiveTriples/active_triples-local_name
|
107
135
|
licenses:
|
108
136
|
- APACHE2
|
109
137
|
metadata: {}
|
@@ -1,81 +0,0 @@
|
|
1
|
-
shared_examples_for "an ActiveModel" do
|
2
|
-
subject { described_class.new }
|
3
|
-
|
4
|
-
describe '#to_key' do
|
5
|
-
it 'should respond' do
|
6
|
-
expect(subject).to respond_to :to_key
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should return nil when #persisted? is false ' do
|
10
|
-
def subject.persisted?() false end
|
11
|
-
expect(subject.to_key).to eq nil
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '#to_param' do
|
16
|
-
it 'should respond' do
|
17
|
-
expect(subject).to respond_to :to_param
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should return nil when #persisted? is false ' do
|
21
|
-
def subject.persisted?() false end
|
22
|
-
expect(subject.to_param).to eq nil
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#model_name' do
|
27
|
-
let(:model_name) { subject.class.model_name }
|
28
|
-
|
29
|
-
it 'should have a model name' do
|
30
|
-
expect(model_name).to respond_to :to_str
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should have a human name' do
|
34
|
-
expect(model_name.human).to respond_to :to_str
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'should have a singular name' do
|
38
|
-
expect(model_name.singular).to respond_to :to_str
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'should have a plural name' do
|
42
|
-
expect(model_name.plural).to respond_to :to_str
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe '#to_partial_path' do
|
47
|
-
it 'should return a string' do
|
48
|
-
expect(subject.to_partial_path).to be_a String
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe '#persisted?' do
|
53
|
-
it 'should return a boolean' do
|
54
|
-
expect(match_boolean(subject.persisted?)).to be true
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe '#valid?' do
|
59
|
-
it 'should return a boolean' do
|
60
|
-
expect(match_boolean(subject.valid?)).to be true
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe '#new_record' do
|
65
|
-
it 'should return a boolean' do
|
66
|
-
expect(match_boolean(subject.new_record?)).to be true
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#destroyed?' do
|
71
|
-
it 'should return a boolean' do
|
72
|
-
expect(match_boolean(subject.destroyed?)).to be true
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
private
|
77
|
-
|
78
|
-
def match_boolean(result)
|
79
|
-
result == true || result == false
|
80
|
-
end
|
81
|
-
end
|