ocean-rails 5.7.1 → 5.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +9 -2
- data/lib/generators/ocean_scaffold/templates/controller_specs/create_spec.rb +14 -14
- data/lib/generators/ocean_scaffold/templates/controller_specs/delete_spec.rb +7 -7
- data/lib/generators/ocean_scaffold/templates/controller_specs/index_spec.rb +10 -10
- data/lib/generators/ocean_scaffold/templates/controller_specs/show_spec.rb +7 -7
- data/lib/generators/ocean_scaffold/templates/controller_specs/update_spec.rb +19 -19
- data/lib/generators/ocean_scaffold/templates/model_spec.rb +14 -14
- data/lib/generators/ocean_scaffold/templates/resource_routing_spec.rb +5 -5
- data/lib/generators/ocean_scaffold/templates/view_specs/_resource_spec.rb +10 -10
- data/lib/generators/ocean_scaffold/templates/views/_resource.json.jbuilder +4 -1
- data/lib/generators/ocean_setup/templates/aws.yml.example +4 -7
- data/lib/generators/ocean_setup/templates/config.yml.example +3 -0
- data/lib/generators/ocean_setup/templates/gitignore +3 -0
- data/lib/generators/ocean_setup/templates/spec_helper.rb +19 -0
- data/lib/ocean/ocean_application_controller.rb +5 -1
- data/lib/ocean/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aad06c44231394d3492ed38bc19f036f30243b0e
|
4
|
+
data.tar.gz: 1954dfcda369f4b8940de7e8b5d9b1f5aec1a2de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d14611e0298e23b7a58c2e70ee4eca110d3bd8d4351e7874c3b84497dfa577421e2d7eda3d631efd6ef65fab7d871a3151207fa3016dda68d964816779c1f52d
|
7
|
+
data.tar.gz: e9c77525b77d657a8b46f074d16e29064fa3359007b5a21904a55a669a37c2f0d7ffb50416a306552d15adf86652ecf671943225ab66bbb2c36ea5ad38719f12
|
data/README.rdoc
CHANGED
@@ -119,10 +119,17 @@ block:
|
|
119
119
|
|
120
120
|
# DynamoDB table cleaner
|
121
121
|
CHEF_ENV = "master" unless defined?(CHEF_ENV)
|
122
|
-
regexp = Regexp.new("^.+_#{CHEF_ENV}_[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}
|
122
|
+
regexp = Regexp.new("^.+_#{CHEF_ENV}_[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}_(test|dev)$")
|
123
123
|
cleaner = lambda {
|
124
124
|
c = Aws::DynamoDB::Client.new
|
125
|
-
c.list_tables.table_names.each
|
125
|
+
c.list_tables.table_names.each do |t|
|
126
|
+
begin
|
127
|
+
c.delete_table({table_name: t}) if t =~ regexp
|
128
|
+
rescue Aws::DynamoDB::Errors::LimitExceededException
|
129
|
+
sleep 1
|
130
|
+
retry
|
131
|
+
end
|
132
|
+
end
|
126
133
|
}
|
127
134
|
|
128
135
|
Then, inside the +RSpec.configure+ block:
|
@@ -16,29 +16,29 @@ describe <%= class_name.pluralize %>Controller do
|
|
16
16
|
|
17
17
|
it "should return JSON" do
|
18
18
|
post :create, @args
|
19
|
-
response.content_type.
|
19
|
+
expect(response.content_type).to eq "application/json"
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should return a 400 if the X-API-Token header is missing" do
|
23
23
|
request.headers['X-API-Token'] = nil
|
24
24
|
post :create, @args
|
25
|
-
response.status.
|
25
|
+
expect(response.status).to eq 400
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should return a 201 when successful" do
|
29
29
|
post :create, @args
|
30
|
-
response.
|
31
|
-
response.status.
|
30
|
+
expect(response).to render_template(partial: "_<%= singular_name %>", count: 1)
|
31
|
+
expect(response.status).to eq 201
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should contain a Location header when successful" do
|
35
35
|
post :create, @args
|
36
|
-
response.headers['Location'].
|
36
|
+
expect(response.headers['Location']).to be_a String
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should return the new resource in the body when successful" do
|
40
40
|
post :create, @args
|
41
|
-
response.body.
|
41
|
+
expect(response.body).to be_a String
|
42
42
|
end
|
43
43
|
|
44
44
|
#
|
@@ -47,12 +47,12 @@ describe <%= class_name.pluralize %>Controller do
|
|
47
47
|
#
|
48
48
|
# it "should return a 422 if the <%= singular_name %> already exists" do
|
49
49
|
# post :create, @args
|
50
|
-
# response.status.
|
51
|
-
# response.content_type.
|
50
|
+
# expect(response.status).to eq 201
|
51
|
+
# expect(response.content_type).to eq "application/json"
|
52
52
|
# post :create, @args
|
53
|
-
# response.status.
|
54
|
-
# response.content_type.
|
55
|
-
# JSON.parse(response.body).
|
53
|
+
# expect(response.status).to eq 422
|
54
|
+
# expect(response.content_type).to eq "application/json"
|
55
|
+
# expect(JSON.parse(response.body).to eq({"_api_error" => ["<%= class_name %> already exists"]})
|
56
56
|
# end
|
57
57
|
|
58
58
|
#
|
@@ -61,9 +61,9 @@ describe <%= class_name.pluralize %>Controller do
|
|
61
61
|
#
|
62
62
|
# it "should return a 422 when there are validation errors" do
|
63
63
|
# post :create, @args.merge('name' => "qz")
|
64
|
-
# response.status.
|
65
|
-
# response.content_type.
|
66
|
-
# JSON.parse(response.body).
|
64
|
+
# expect(response.status).to eq 422
|
65
|
+
# expect(response.content_type).to eq "application/json"
|
66
|
+
# expect(JSON.parse(response.body)).to eq({"name"=>["is too short (minimum is 3 characters)"]})
|
67
67
|
# end
|
68
68
|
|
69
69
|
end
|
@@ -16,30 +16,30 @@ describe <%= class_name.pluralize %>Controller do
|
|
16
16
|
|
17
17
|
it "should return JSON" do
|
18
18
|
delete :destroy, id: @<%= singular_name %>
|
19
|
-
response.content_type.
|
19
|
+
expect(response.content_type).to eq "application/json"
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should return a 400 if the X-API-Token header is missing" do
|
23
23
|
request.headers['X-API-Token'] = nil
|
24
24
|
delete :destroy, id: @<%= singular_name %>
|
25
|
-
response.status.
|
25
|
+
expect(response.status).to eq 400
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should return a 204 when successful" do
|
29
29
|
delete :destroy, id: @<%= singular_name %>
|
30
|
-
response.status.
|
31
|
-
response.content_type.
|
30
|
+
expect(response.status).to eq 204
|
31
|
+
expect(response.content_type).to eq "application/json"
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should return a 404 when the <%= class_name %> can't be found" do
|
35
35
|
delete :destroy, id: "0-0-0-0-0"
|
36
|
-
response.status.
|
36
|
+
expect(response.status).to eq 404
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should destroy the <%= class_name %> when successful" do
|
40
40
|
delete :destroy, id: @<%= singular_name %>
|
41
|
-
response.status.
|
42
|
-
<%= class_name %>.find_by_id(@<%= singular_name %>.id).
|
41
|
+
expect(response.status).to eq 204
|
42
|
+
expect(<%= class_name %>.find_by_id(@<%= singular_name %>.id)).to be_nil
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
@@ -18,32 +18,32 @@ describe <%= class_name.pluralize %>Controller do
|
|
18
18
|
|
19
19
|
it "should return JSON" do
|
20
20
|
get :index
|
21
|
-
response.content_type.
|
21
|
+
expect(response.content_type).to eq "application/json"
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should return a 400 if the X-API-Token header is missing" do
|
25
25
|
request.headers['X-API-Token'] = nil
|
26
26
|
get :index
|
27
|
-
response.status.
|
28
|
-
response.content_type.
|
27
|
+
expect(response.status).to eq 400
|
28
|
+
expect(response.content_type).to eq "application/json"
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should return a 200 when successful" do
|
32
32
|
get :index
|
33
|
-
response.status.
|
34
|
-
response.
|
33
|
+
expect(response.status).to eq 200
|
34
|
+
expect(response).to render_template(partial: "_<%= singular_name %>", count: 3)
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should return a collection" do
|
38
38
|
get :index
|
39
|
-
response.status.
|
39
|
+
expect(response.status).to eq 200
|
40
40
|
wrapper = JSON.parse(response.body)
|
41
|
-
wrapper.
|
41
|
+
expect(wrapper).to be_a Hash
|
42
42
|
resource = wrapper['_collection']
|
43
|
-
resource.
|
43
|
+
expect(resource).to be_a Hash
|
44
44
|
coll = resource['resources']
|
45
|
-
coll.
|
46
|
-
coll.count.
|
45
|
+
expect(coll).to be_an Array
|
46
|
+
expect(coll.count).to eq 3
|
47
47
|
end
|
48
48
|
|
49
49
|
end
|
@@ -16,26 +16,26 @@ describe <%= class_name.pluralize %>Controller do
|
|
16
16
|
|
17
17
|
it "should return JSON" do
|
18
18
|
get :show, id: @<%= singular_name %>
|
19
|
-
response.content_type.
|
19
|
+
expect(response.content_type).to eq "application/json"
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should return a 400 if the X-API-Token header is missing" do
|
23
23
|
request.headers['X-API-Token'] = nil
|
24
24
|
get :show, id: @<%= singular_name %>
|
25
|
-
response.status.
|
26
|
-
response.content_type.
|
25
|
+
expect(response.status).to eq 400
|
26
|
+
expect(response.content_type).to eq "application/json"
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should return a 404 when the user can't be found" do
|
30
30
|
get :show, id: "0-0-0-0-0"
|
31
|
-
response.status.
|
32
|
-
response.content_type.
|
31
|
+
expect(response.status).to eq 404
|
32
|
+
expect(response.content_type).to eq "application/json"
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should return a 200 when successful" do
|
36
36
|
get :show, id: @<%= singular_name %>
|
37
|
-
response.status.
|
38
|
-
response.
|
37
|
+
expect(response.status).to eq 200
|
38
|
+
expect(response).to render_template(partial: "_<%= singular_name %>", count: 1)
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
@@ -17,43 +17,43 @@ describe <%= class_name.pluralize %>Controller do
|
|
17
17
|
|
18
18
|
it "should return JSON" do
|
19
19
|
put :update, @args
|
20
|
-
response.content_type.
|
20
|
+
expect(response.content_type).to eq "application/json"
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should return a 400 if the X-API-Token header is missing" do
|
24
24
|
request.headers['X-API-Token'] = nil
|
25
25
|
put :update, @args
|
26
|
-
response.status.
|
26
|
+
expect(response.status).to eq 400
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should return a 404 if the resource can't be found" do
|
30
30
|
put :update, id: "0-0-0-0-0"
|
31
|
-
response.status.
|
32
|
-
response.content_type.
|
31
|
+
expect(response.status).to eq 404
|
32
|
+
expect(response.content_type).to eq "application/json"
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should return a 422 when resource properties are missing (all must be set simultaneously)" do
|
36
36
|
put :update, id: @u.id
|
37
|
-
response.status.
|
38
|
-
response.content_type.
|
37
|
+
expect(response.status).to eq 422
|
38
|
+
expect(response.content_type).to eq "application/json"
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should return a 409 when there is an update conflict" do
|
42
42
|
@u.update_attributes!({:updated_at => 1.week.from_now}, :without_protection => true)
|
43
43
|
put :update, @args
|
44
|
-
response.status.
|
44
|
+
expect(response.status).to eq 409
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should return a 200 when successful" do
|
48
48
|
put :update, @args
|
49
|
-
response.status.
|
50
|
-
response.
|
49
|
+
expect(response.status).to eq 200
|
50
|
+
expect(response).to render_template(partial: "_<%= singular_name %>", count: 1)
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should return the updated resource in the body when successful" do
|
54
54
|
put :update, @args
|
55
|
-
response.status.
|
56
|
-
JSON.parse(response.body).
|
55
|
+
expect(response.status).to eq 200
|
56
|
+
expect(JSON.parse(response.body)).to be_a Hash
|
57
57
|
end
|
58
58
|
|
59
59
|
#
|
@@ -62,22 +62,22 @@ describe <%= class_name.pluralize %>Controller do
|
|
62
62
|
#
|
63
63
|
# it "should return a 422 when there are validation errors" do
|
64
64
|
# put :update, @args.merge('name' => "qz")
|
65
|
-
# response.status.
|
66
|
-
# response.content_type.
|
67
|
-
# JSON.parse(response.body).
|
65
|
+
# expect(response.status).to eq 422
|
66
|
+
# expect(response.content_type).to eq "application/json"
|
67
|
+
# expect(JSON.parse(response.body)).to eq({"name"=>["is too short (minimum is 3 characters)"]})
|
68
68
|
# end
|
69
69
|
|
70
70
|
|
71
71
|
# it "should alter the <%= singular_name %> when successful" do
|
72
|
-
# @u.name.
|
73
|
-
# @u.description.
|
72
|
+
# expect(@u.name).to eq @args['name']
|
73
|
+
# expect(@u.description).to eq @args['description']
|
74
74
|
# @args['name'] = "zalagadoola"
|
75
75
|
# @args['description'] = "menchikaboola"
|
76
76
|
# put :update, @args
|
77
|
-
# response.status.
|
77
|
+
# expect(response.status).to eq 200
|
78
78
|
# @u.reload
|
79
|
-
# @u.name.
|
80
|
-
# @u.description.
|
79
|
+
# expect(@u.name).to eq "zalagadoola"
|
80
|
+
# expect(@u.description).to eq "menchikaboola"
|
81
81
|
# end
|
82
82
|
|
83
83
|
end
|
@@ -6,27 +6,27 @@ describe <%= class_name %> do
|
|
6
6
|
describe "attributes" do
|
7
7
|
|
8
8
|
it "should have a name" do
|
9
|
-
create(:<%= singular_name %>).name.
|
9
|
+
expect(create(:<%= singular_name %>).name).to be_a String
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should have a description" do
|
13
|
-
create(:<%= singular_name %>).description.
|
13
|
+
expect(create(:<%= singular_name %>).description).to be_a String
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should have a creation time" do
|
17
|
-
create(:<%= singular_name %>).created_at.
|
17
|
+
expect(create(:<%= singular_name %>).created_at).to be_a Time
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should have an update time" do
|
21
|
-
create(:<%= singular_name %>).updated_at.
|
21
|
+
expect(create(:<%= singular_name %>).updated_at).to be_a Time
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should have a creator" do
|
25
|
-
create(:<%= singular_name %>).created_by.
|
25
|
+
expect(create(:<%= singular_name %>).created_by).to be_a String
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should have an updater" do
|
29
|
-
create(:<%= singular_name %>).updated_by.
|
29
|
+
expect(create(:<%= singular_name %>).updated_by).to be_a String
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
@@ -51,23 +51,23 @@ describe <%= class_name %> do
|
|
51
51
|
|
52
52
|
it "should return an array of <%= class_name %> instances" do
|
53
53
|
ix = <%= class_name %>.collection
|
54
|
-
ix.length.
|
55
|
-
ix[0].
|
54
|
+
expect(ix.length).to eq 3
|
55
|
+
expect(ix[0]).to be_a <%= class_name %>
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should allow matches on name" do
|
59
|
-
<%= class_name %>.collection(name: 'NOWAI').length.
|
60
|
-
<%= class_name %>.collection(name: 'bar').length.
|
61
|
-
<%= class_name %>.collection(name: 'baz').length.
|
59
|
+
expect(<%= class_name %>.collection(name: 'NOWAI').length).to eq 0
|
60
|
+
expect(<%= class_name %>.collection(name: 'bar').length).to eq 1
|
61
|
+
expect(<%= class_name %>.collection(name: 'baz').length).to eq 1
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should allow searches on description" do
|
65
|
-
<%= class_name %>.collection(search: 'a').length.
|
66
|
-
<%= class_name %>.collection(search: 'object').length.
|
65
|
+
expect(<%= class_name %>.collection(search: 'a').length).to eq 2
|
66
|
+
expect(<%= class_name %>.collection(search: 'object').length).to eq 3
|
67
67
|
end
|
68
68
|
|
69
69
|
it "key/value pairs not in the index_only array should quietly be ignored" do
|
70
|
-
<%= class_name %>.collection(name: 'bar', aardvark: 12).length.
|
70
|
+
expect(<%= class_name %>.collection(name: 'bar', aardvark: 12).length).to eq 1
|
71
71
|
end
|
72
72
|
|
73
73
|
end
|
@@ -4,23 +4,23 @@ describe <%= class_name.pluralize %>Controller do
|
|
4
4
|
describe "routing" do
|
5
5
|
|
6
6
|
it "routes to #index" do
|
7
|
-
get("/v1/<%= plural_name %>").
|
7
|
+
expect(get("/v1/<%= plural_name %>")).to route_to("<%= plural_name %>#index")
|
8
8
|
end
|
9
9
|
|
10
10
|
it "routes to #show" do
|
11
|
-
get("/v1/<%= plural_name %>/1-2-3-4-5").
|
11
|
+
expect(get("/v1/<%= plural_name %>/1-2-3-4-5")).to route_to("<%= plural_name %>#show", id: "1-2-3-4-5")
|
12
12
|
end
|
13
13
|
|
14
14
|
it "routes to #create" do
|
15
|
-
post("/v1/<%= plural_name %>").
|
15
|
+
expect(post("/v1/<%= plural_name %>")).to route_to("<%= plural_name %>#create")
|
16
16
|
end
|
17
17
|
|
18
18
|
it "routes to #update" do
|
19
|
-
put("/v1/<%= plural_name %>/1-2-3-4-5").
|
19
|
+
expect(put("/v1/<%= plural_name %>/1-2-3-4-5")).to route_to("<%= plural_name %>#update", id: "1-2-3-4-5")
|
20
20
|
end
|
21
21
|
|
22
22
|
it "routes to #destroy" do
|
23
|
-
delete("/v1/<%= plural_name %>/1-2-3-4-5").
|
23
|
+
expect(delete("/v1/<%= plural_name %>/1-2-3-4-5")).to route_to("<%= plural_name %>#destroy", id: "1-2-3-4-5")
|
24
24
|
end
|
25
25
|
|
26
26
|
end
|
@@ -11,45 +11,45 @@ describe "<%= plural_name %>/_<%= singular_name %>" do
|
|
11
11
|
|
12
12
|
|
13
13
|
it "has a named root" do
|
14
|
-
@u.
|
14
|
+
expect(@u).not_to eq nil
|
15
15
|
end
|
16
16
|
|
17
17
|
|
18
18
|
it "should have three hyperlinks" do
|
19
|
-
@links.size.
|
19
|
+
expect(@links.size).to eq 3
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should have a self hyperlink" do
|
23
|
-
@links.
|
23
|
+
expect(@links).to be_hyperlinked('self', /<%= plural_name %>/)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should have a creator hyperlink" do
|
27
|
-
@links.
|
27
|
+
expect(@links).to be_hyperlinked('creator', /api_users/)
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should have an updater hyperlink" do
|
31
|
-
@links.
|
31
|
+
expect(@links).to be_hyperlinked('updater', /api_users/)
|
32
32
|
end
|
33
33
|
|
34
34
|
|
35
35
|
it "should have a name" do
|
36
|
-
@u['name'].
|
36
|
+
expect(@u['name']).to be_a String
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should have a description" do
|
40
|
-
@u['description'].
|
40
|
+
expect(@u['description']).to be_a String
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should have a created_at time" do
|
44
|
-
@u['created_at'].
|
44
|
+
expect(@u['created_at']).to be_a String
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should have an updated_at time" do
|
48
|
-
@u['updated_at'].
|
48
|
+
expect(@u['updated_at']).to be_a String
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should have a lock_version field" do
|
52
|
-
@u['lock_version'].
|
52
|
+
expect(@u['lock_version']).to be_an Integer
|
53
53
|
end
|
54
54
|
|
55
55
|
end
|
@@ -2,7 +2,10 @@ json.<%= singular_name %> do |json|
|
|
2
2
|
json._links hyperlinks(self: <%= singular_name %>_url(<%= singular_name %>),
|
3
3
|
creator: smart_api_user_url(<%= singular_name %>.created_by),
|
4
4
|
updater: smart_api_user_url(<%= singular_name %>.updated_by))
|
5
|
-
json.(<%= singular_name %>, :lock_version,
|
5
|
+
json.(<%= singular_name %>, :lock_version,
|
6
|
+
:name,
|
7
|
+
:description
|
8
|
+
)
|
6
9
|
json.created_at <%= singular_name %>.created_at.utc.iso8601
|
7
10
|
json.updated_at <%= singular_name %>.updated_at.utc.iso8601
|
8
11
|
end
|
@@ -13,18 +13,15 @@
|
|
13
13
|
|
14
14
|
|
15
15
|
fake_dynamo: &local
|
16
|
-
|
17
|
-
|
18
|
-
dynamo_db_port: 4567
|
16
|
+
region: eu-west-1
|
17
|
+
endpoint: http://localhost:8000
|
19
18
|
access_key_id: xxx
|
20
19
|
secret_access_key: xxx
|
21
|
-
user_agent_prefix: Ocean
|
22
20
|
|
23
21
|
amazon: &amazon
|
22
|
+
region: eu-west-1
|
24
23
|
access_key_id: YOURACCESSKEYHERE
|
25
24
|
secret_access_key: YOURSECRETKEYHERE
|
26
|
-
region: eu-west-1
|
27
|
-
user_agent_prefix: Ocean
|
28
25
|
|
29
26
|
|
30
27
|
#
|
@@ -41,4 +38,4 @@ test:
|
|
41
38
|
<<: *local
|
42
39
|
|
43
40
|
production:
|
44
|
-
<<: *
|
41
|
+
<<: *amazon
|
@@ -40,6 +40,9 @@ LOAD_BALANCERS: []
|
|
40
40
|
# This is the list of IP numbers for the ZeroMQ log hosts. (Only used in production.)
|
41
41
|
LOG_HOSTS: []
|
42
42
|
|
43
|
+
# The Chef environment
|
44
|
+
CHEF_ENV: master
|
45
|
+
|
43
46
|
|
44
47
|
##########################################################################################
|
45
48
|
# This section allows you to specify values specific for a particular Rails
|
@@ -13,6 +13,21 @@ require 'rspec/rails'
|
|
13
13
|
# in spec/support/ and its subdirectories.
|
14
14
|
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
15
15
|
|
16
|
+
# DynamoDB table cleaner
|
17
|
+
CHEF_ENV = "master" unless defined?(CHEF_ENV)
|
18
|
+
regexp = Regexp.new("^.+_#{CHEF_ENV}_[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}_(test|dev)$")
|
19
|
+
cleaner = lambda {
|
20
|
+
c = Aws::DynamoDB::Client.new
|
21
|
+
c.list_tables.table_names.each do |t|
|
22
|
+
begin
|
23
|
+
c.delete_table({table_name: t}) if t =~ regexp
|
24
|
+
rescue Aws::DynamoDB::Errors::LimitExceededException
|
25
|
+
sleep 1
|
26
|
+
retry
|
27
|
+
end
|
28
|
+
end
|
29
|
+
}
|
30
|
+
|
16
31
|
RSpec.configure do |config|
|
17
32
|
# ## Mock Framework
|
18
33
|
#
|
@@ -43,6 +58,10 @@ RSpec.configure do |config|
|
|
43
58
|
|
44
59
|
# Make "FactoryGirl" superfluous
|
45
60
|
config.include FactoryGirl::Syntax::Methods
|
61
|
+
|
62
|
+
# Uncomment the following two lines if you're using DynamoDB tables
|
63
|
+
#config.before(:suite) { cleaner.call }
|
64
|
+
#config.after(:suite) { cleaner.call }
|
46
65
|
end
|
47
66
|
|
48
67
|
|
@@ -159,7 +159,11 @@ module OceanApplicationController
|
|
159
159
|
# their standard position, begin with an underscore, etc. The +ocean+ gem generator
|
160
160
|
# for resources creates a partial in the proper location.
|
161
161
|
#
|
162
|
-
def api_render(x,
|
162
|
+
def api_render(x,
|
163
|
+
new: false,
|
164
|
+
href: x.present? && url_for(params),
|
165
|
+
override_partial: false
|
166
|
+
)
|
163
167
|
if !x.is_a?(Array) && !(defined?(ActiveRecord) && x.is_a?(ActiveRecord::Relation))
|
164
168
|
partial = override_partial || x.to_partial_path
|
165
169
|
if new
|
data/lib/ocean/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ocean-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.7.
|
4
|
+
version: 5.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Bengtson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|