g5_updatable 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/g5_updatable/location.rb +6 -0
- data/lib/g5_updatable/version.rb +1 -1
- data/spec/dummy/config/database.yml +0 -1
- data/spec/dummy/log/development.log +191 -0
- data/spec/dummy/log/test.log +12411 -11651
- data/spec/models/g5_updatable/location_spec.rb +43 -24
- metadata +7 -5
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe G5Updatable::Location do
|
4
|
-
describe
|
4
|
+
describe 'validations' do
|
5
5
|
subject(:location) { G5Updatable::Location.new }
|
6
6
|
|
7
7
|
it { expect(location).to validate_presence_of(:uid) }
|
@@ -9,52 +9,71 @@ describe G5Updatable::Location do
|
|
9
9
|
it { expect(location).to validate_presence_of(:client_uid) }
|
10
10
|
end
|
11
11
|
|
12
|
-
it_behaves_like
|
12
|
+
it_behaves_like 'a model with first-class properties' do
|
13
13
|
let(:instance_factory_name) { :location }
|
14
14
|
end
|
15
15
|
|
16
|
-
it_behaves_like
|
16
|
+
it_behaves_like 'a model that uses its URN as its parameter' do
|
17
17
|
let(:instance_factory_name) { :location }
|
18
18
|
end
|
19
19
|
|
20
|
-
describe
|
21
|
-
let(:client) {
|
22
|
-
let(:location) {
|
20
|
+
describe '#client' do
|
21
|
+
let(:client) { create(:client) }
|
22
|
+
let(:location) { create(:location, client_uid: client.uid) }
|
23
23
|
subject { location.client }
|
24
24
|
|
25
25
|
it { should eq(client) }
|
26
26
|
|
27
|
-
describe
|
28
|
-
it
|
27
|
+
describe 'client_urn' do
|
28
|
+
it 'delegates client_urn to client' do
|
29
29
|
expect(location.client_urn).to eq(client.urn)
|
30
30
|
end
|
31
31
|
|
32
|
-
it
|
32
|
+
it 'returns nil if client not found' do
|
33
33
|
expect(create(:location, client_uid: 'madeup').client_urn).to be_nil
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
context
|
39
|
-
let!(:location) {
|
40
|
-
let!(:location2) {
|
38
|
+
context 'scopes' do
|
39
|
+
let!(:location) { create(:location) }
|
40
|
+
let!(:location2) { create(:location, client_uid: 'something_else', urn: 'another_urn') }
|
41
41
|
|
42
|
-
describe
|
43
|
-
it
|
42
|
+
describe '.by_client_uid' do
|
43
|
+
it 'returns locations' do
|
44
44
|
expect(described_class.by_client_uid(location.client_uid)).to eq [location]
|
45
|
-
end
|
46
|
-
end
|
45
|
+
end
|
46
|
+
end
|
47
47
|
|
48
|
-
describe
|
49
|
-
it
|
48
|
+
describe '.max_updated_at' do
|
49
|
+
it 'returns locations' do
|
50
50
|
expect(described_class.max_updated_at.to_s).to eq location2.updated_at.to_s
|
51
|
-
end
|
52
|
-
end
|
51
|
+
end
|
52
|
+
end
|
53
53
|
|
54
|
-
describe
|
55
|
-
it
|
54
|
+
describe '.by_urn' do
|
55
|
+
it 'returns locations' do
|
56
56
|
expect(described_class.by_urn(location.urn)).to eq [location]
|
57
|
-
end
|
58
|
-
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#display_name' do
|
62
|
+
subject { location }
|
63
|
+
context 'with branded name' do
|
64
|
+
let(:branded_name) { 'a brand' }
|
65
|
+
let(:location) { create(:location, properties: {internal_branded_name: branded_name}) }
|
66
|
+
its(:display_name) { is_expected.to eq(branded_name) }
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'without branded name' do
|
70
|
+
let(:location) { create(:location) }
|
71
|
+
its(:display_name) { is_expected.to eq(location.name) }
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'without properties' do
|
75
|
+
let(:location) { create(:location, properties: nil) }
|
76
|
+
its(:display_name) { is_expected.to be_nil }
|
77
|
+
end
|
59
78
|
end
|
60
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: g5_updatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -98,14 +98,14 @@ dependencies:
|
|
98
98
|
name: rspec-rails
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 3.0.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 3.0.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
@@ -239,6 +239,7 @@ files:
|
|
239
239
|
- spec/dummy/db/migrate/20141222072623_create_restaurants.rb
|
240
240
|
- spec/dummy/db/schema.rb
|
241
241
|
- spec/dummy/db/test.sqlite3
|
242
|
+
- spec/dummy/log/development.log
|
242
243
|
- spec/dummy/log/test.log
|
243
244
|
- spec/dummy/public/404.html
|
244
245
|
- spec/dummy/public/422.html
|
@@ -279,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
279
280
|
version: '0'
|
280
281
|
requirements: []
|
281
282
|
rubyforge_project:
|
282
|
-
rubygems_version: 2.4.
|
283
|
+
rubygems_version: 2.4.5.1
|
283
284
|
signing_key:
|
284
285
|
specification_version: 4
|
285
286
|
summary: Client/Locations data update engine for G5 applications
|
@@ -328,6 +329,7 @@ test_files:
|
|
328
329
|
- spec/dummy/db/migrate/20141222072623_create_restaurants.rb
|
329
330
|
- spec/dummy/db/schema.rb
|
330
331
|
- spec/dummy/db/test.sqlite3
|
332
|
+
- spec/dummy/log/development.log
|
331
333
|
- spec/dummy/log/test.log
|
332
334
|
- spec/dummy/public/404.html
|
333
335
|
- spec/dummy/public/422.html
|