uuids 0.2.0 → 1.0.0.pre.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,36 +17,54 @@ module Uuids
17
17
 
18
18
  context "from AR model" do
19
19
 
20
- # For running this specification, the Item AR model prepared in the
21
- # `spec dummy/app/models/item.rb`.
22
- before { Item.include Uuids::Base }
23
- subject(:item) { Item.new }
24
-
25
- it "defines the #uuids attribute properly" do
26
- subject.uuids.new value: SecureRandom.uuid
27
- subject.save!
28
- expect(Uuids::Uuid.first.try(:record)).to eq subject
29
- expect(subject.uuids.first).to eq Uuids::Uuid.first
20
+ it "doesn't fail" do
21
+ expect { City.include Uuids::Base }.not_to raise_error
30
22
  end
23
+ end
24
+ end
31
25
 
32
- it "creates the first uuid by default" do
33
- subject.save!
34
- expect(subject.uuids.reload).not_to be_blank
35
- end
26
+ describe ".has_uuids" do
36
27
 
37
- it "requires the #uuids attribute" do
38
- subject.save!
39
- subject.uuids.each(&:delete)
40
- expect(subject.reload).not_to be_valid
41
- end
28
+ # For running this specification, the City AR model prepared in the
29
+ # `spec dummy/app/models/item.rb`. The model included Uuids::Base.
30
+ before { City.send :has_uuids }
31
+ subject { City.new }
42
32
 
43
- it "forbids destruction if uuids present" do
44
- subject.save!
45
- expect { subject.destroy! }.to raise_error
46
- subject.uuids.each(&:delete)
47
- subject.reload
48
- expect { subject.destroy! }.not_to raise_error
49
- end
33
+ it "defines the #uuids attribute" do
34
+ subject.uuids.new value: SecureRandom.uuid
35
+ subject.save!
36
+ expect(Uuids::Uuid.first.try(:record)).to eq subject
37
+ expect(subject.uuids.first).to eq Uuids::Uuid.first
38
+ end
39
+
40
+ it "defines the #uuid method" do
41
+ 2.times { subject.uuids.new value: SecureRandom.uuid }
42
+ subject.save!
43
+ expect(subject.uuid).to eq subject.uuids.first.value
44
+ end
45
+
46
+ it "defines +by_uuid+ class scope" do
47
+ subject.save!
48
+ expect(City.by_uuid(subject.uuid).first).to eq subject
49
+ end
50
+
51
+ it "creates the first uuid by default" do
52
+ subject.save!
53
+ expect(subject.uuid).not_to be_blank
54
+ end
55
+
56
+ it "requires the #uuids attribute" do
57
+ subject.save!
58
+ subject.uuids.each(&:delete)
59
+ expect(subject.reload).not_to be_valid
60
+ end
61
+
62
+ it "forbids destruction if uuids present" do
63
+ subject.save!
64
+ expect { subject.destroy! }.to raise_error
65
+ subject.uuids.each(&:delete)
66
+ subject.reload
67
+ expect { subject.destroy! }.not_to raise_error
50
68
  end
51
69
  end
52
70
  end
@@ -1,4 +1,4 @@
1
1
  # Check test coverage
2
2
  require "coveralls"
3
3
 
4
- Coveralls.wear!
4
+ Coveralls.wear! "rails"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uuids
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0.pre.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kozin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-17 00:00:00.000000000 Z
11
+ date: 2014-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -150,7 +150,7 @@ files:
150
150
  - spec/dummy/app/assets/stylesheets/application.css
151
151
  - spec/dummy/app/controllers/application_controller.rb
152
152
  - spec/dummy/app/helpers/application_helper.rb
153
- - spec/dummy/app/models/item.rb
153
+ - spec/dummy/app/models/city.rb
154
154
  - spec/dummy/app/models/record.rb
155
155
  - spec/dummy/app/views/layouts/application.html.erb
156
156
  - spec/dummy/bin/bundle
@@ -176,7 +176,7 @@ files:
176
176
  - spec/dummy/config/routes.rb
177
177
  - spec/dummy/config/secrets.yml
178
178
  - spec/dummy/db/migrate/20141016113016_create_records.rb
179
- - spec/dummy/db/migrate/20141017081115_create_items.rb
179
+ - spec/dummy/db/migrate/20141017081115_create_cities.rb
180
180
  - spec/dummy/db/schema.rb
181
181
  - spec/dummy/db/test.sqlite3
182
182
  - spec/dummy/log/development.log
@@ -215,9 +215,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
215
  version: '2.1'
216
216
  required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  requirements:
218
- - - ">="
218
+ - - ">"
219
219
  - !ruby/object:Gem::Version
220
- version: '0'
220
+ version: 1.3.1
221
221
  requirements: []
222
222
  rubyforge_project:
223
223
  rubygems_version: 2.2.2
@@ -249,13 +249,13 @@ test_files:
249
249
  - spec/dummy/config/initializers/cookies_serializer.rb
250
250
  - spec/dummy/config/initializers/filter_parameter_logging.rb
251
251
  - spec/dummy/config/initializers/assets.rb
252
- - spec/dummy/db/migrate/20141017081115_create_items.rb
252
+ - spec/dummy/db/migrate/20141017081115_create_cities.rb
253
253
  - spec/dummy/db/migrate/20141016113016_create_records.rb
254
254
  - spec/dummy/db/test.sqlite3
255
255
  - spec/dummy/db/schema.rb
256
256
  - spec/dummy/app/views/layouts/application.html.erb
257
257
  - spec/dummy/app/models/record.rb
258
- - spec/dummy/app/models/item.rb
258
+ - spec/dummy/app/models/city.rb
259
259
  - spec/dummy/app/assets/javascripts/application.js
260
260
  - spec/dummy/app/assets/stylesheets/application.css
261
261
  - spec/dummy/app/helpers/application_helper.rb
@@ -1,4 +0,0 @@
1
- require "uuids"
2
-
3
- class Item < ActiveRecord::Base
4
- end
@@ -1,8 +0,0 @@
1
- class CreateItems < ActiveRecord::Migration
2
- def change
3
- create_table :items do |t|
4
-
5
- t.timestamps
6
- end
7
- end
8
- end