pliny 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- data/README.md +59 -11
- data/bin/pliny-generate +2 -14
- data/bin/pliny-new +1 -1
- data/lib/pliny.rb +1 -2
- data/lib/pliny/commands/creator.rb +10 -11
- data/lib/pliny/commands/generator.rb +50 -199
- data/lib/pliny/commands/generator/base.rb +59 -0
- data/lib/pliny/commands/generator/endpoint.rb +44 -0
- data/lib/pliny/commands/generator/mediator.rb +21 -0
- data/lib/pliny/commands/generator/migration.rb +13 -0
- data/lib/pliny/commands/generator/model.rb +30 -0
- data/lib/pliny/commands/generator/schema.rb +24 -0
- data/lib/pliny/commands/generator/serializer.rb +21 -0
- data/lib/pliny/config_helpers.rb +52 -0
- data/lib/pliny/helpers/encode.rb +7 -0
- data/lib/pliny/log.rb +18 -1
- data/lib/pliny/middleware/versioning.rb +3 -3
- data/lib/pliny/tasks/db.rake +21 -7
- data/lib/pliny/tasks/schema.rake +2 -2
- data/lib/pliny/templates/endpoint.erb +5 -5
- data/lib/pliny/templates/endpoint_acceptance_test.erb +1 -1
- data/lib/pliny/templates/endpoint_scaffold.erb +5 -5
- data/lib/pliny/templates/endpoint_scaffold_acceptance_test.erb +1 -1
- data/lib/pliny/templates/endpoint_test.erb +1 -0
- data/lib/pliny/templates/migration.erb +0 -2
- data/lib/pliny/templates/model.erb +0 -2
- data/lib/pliny/templates/model_test.erb +0 -1
- data/lib/pliny/templates/serializer_test.erb +0 -1
- data/lib/pliny/version.rb +1 -1
- data/template/.env.sample +2 -1
- data/template/README.md +1 -1
- data/template/bin/console +1 -3
- data/template/bin/run +1 -3
- data/template/config.ru +1 -4
- data/template/config/config.rb +19 -25
- data/template/config/initializers/rollbar.rb +1 -0
- data/template/config/puma.rb +2 -2
- data/template/db/schema.sql +1 -2
- data/template/lib/application.rb +4 -0
- data/template/lib/endpoints/base.rb +1 -0
- data/template/lib/routes.rb +1 -1
- data/template/lib/serializers/base.rb +8 -1
- data/test/commands/creator_test.rb +1 -0
- data/test/commands/generator/base_test.rb +103 -0
- data/test/commands/generator/endpoint_test.rb +15 -0
- data/test/commands/generator_test.rb +95 -134
- data/test/log_test.rb +16 -0
- metadata +100 -69
@@ -6,7 +6,7 @@ module Endpoints
|
|
6
6
|
end
|
7
7
|
|
8
8
|
get do
|
9
|
-
|
9
|
+
encode serialize(<%= singular_class_name %>.all)
|
10
10
|
end
|
11
11
|
|
12
12
|
post do
|
@@ -14,25 +14,25 @@ module Endpoints
|
|
14
14
|
<%= field_name %> = <%= singular_class_name %>.new(body_params)
|
15
15
|
<%= field_name %>.save
|
16
16
|
status 201
|
17
|
-
|
17
|
+
encode serialize(<%= field_name %>)
|
18
18
|
end
|
19
19
|
|
20
20
|
get "/:id" do |id|
|
21
21
|
<%= field_name %> = <%= singular_class_name %>.first(uuid: id) || halt(404)
|
22
|
-
|
22
|
+
encode serialize(<%= field_name %>)
|
23
23
|
end
|
24
24
|
|
25
25
|
patch "/:id" do |id|
|
26
26
|
<%= field_name %> = <%= singular_class_name %>.first(uuid: id) || halt(404)
|
27
27
|
# warning: not safe
|
28
28
|
#<%= field_name %>.update(body_params)
|
29
|
-
|
29
|
+
encode serialize(<%= field_name %>)
|
30
30
|
end
|
31
31
|
|
32
32
|
delete "/:id" do |id|
|
33
33
|
<%= field_name %> = <%= singular_class_name %>.first(uuid: id) || halt(404)
|
34
34
|
<%= field_name %>.destroy
|
35
|
-
|
35
|
+
encode serialize(<%= field_name %>)
|
36
36
|
end
|
37
37
|
|
38
38
|
private
|
@@ -29,7 +29,7 @@ describe Endpoints::<%= plural_class_name %> do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
=begin
|
32
|
-
describe 'POST <%= url_path
|
32
|
+
describe 'POST <%= url_path %>' do
|
33
33
|
it 'returns correct status code and conforms to schema' do
|
34
34
|
header "Content-Type", "application/json"
|
35
35
|
post '<%= url_path %>', MultiJson.encode({})
|
data/lib/pliny/version.rb
CHANGED
data/template/.env.sample
CHANGED
data/template/README.md
CHANGED
data/template/bin/console
CHANGED
data/template/bin/run
CHANGED
data/template/config.ru
CHANGED
data/template/config/config.rb
CHANGED
@@ -6,35 +6,29 @@ require "pliny/config_helpers"
|
|
6
6
|
#
|
7
7
|
# Each accessor corresponds directly to an ENV key, which has the same name
|
8
8
|
# except upcased, i.e. `DATABASE_URL`.
|
9
|
-
#
|
10
|
-
# Note that *all* keys will come out as strings even if the override was a
|
11
|
-
# different type. Make sure to typecast any values that need to be something
|
12
|
-
# else (i.e. `.to_i`).
|
13
9
|
module Config
|
14
|
-
extend Pliny::
|
10
|
+
extend Pliny::CastingConfigHelpers
|
15
11
|
|
16
12
|
# Mandatory -- exception is raised for these variables when missing.
|
17
|
-
mandatory
|
18
|
-
:database_url
|
13
|
+
mandatory :database_url, string
|
19
14
|
|
20
15
|
# Optional -- value is returned or `nil` if it wasn't present.
|
21
|
-
optional
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
:versioning_app_name
|
16
|
+
optional :console_banner, string
|
17
|
+
optional :placeholder, string
|
18
|
+
optional :versioning_default, string
|
19
|
+
optional :versioning_app_name, string
|
26
20
|
|
27
|
-
# Override -- value is returned or the set default.
|
28
|
-
override
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
21
|
+
# Override -- value is returned or the set default.
|
22
|
+
override :db_pool, 5, int
|
23
|
+
override :port, 5000, int
|
24
|
+
override :puma_max_threads, 16, int
|
25
|
+
override :puma_min_threads, 1, int
|
26
|
+
override :puma_workers, 3, int
|
27
|
+
override :rack_env, 'development', string
|
28
|
+
override :raise_errors, false, bool
|
29
|
+
override :root, File.expand_path("../../", __FILE__), string
|
30
|
+
override :timeout, 45, int
|
31
|
+
override :force_ssl, true, bool
|
32
|
+
override :versioning, false, bool
|
33
|
+
override :pretty_json, false, bool
|
40
34
|
end
|
data/template/config/puma.rb
CHANGED
@@ -3,8 +3,8 @@ require "./config/config"
|
|
3
3
|
environment Config.rack_env
|
4
4
|
port Config.port
|
5
5
|
quiet
|
6
|
-
threads Config.puma_min_threads
|
7
|
-
workers Config.puma_workers
|
6
|
+
threads Config.puma_min_threads, Config.puma_max_threads
|
7
|
+
workers Config.puma_workers
|
8
8
|
|
9
9
|
on_worker_boot do
|
10
10
|
# force Sequel's thread pool to be refreshed
|
data/template/db/schema.sql
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
--
|
4
4
|
|
5
5
|
SET statement_timeout = 0;
|
6
|
+
SET lock_timeout = 0;
|
6
7
|
SET client_encoding = 'UTF8';
|
7
8
|
SET standard_conforming_strings = on;
|
8
9
|
SET check_function_bodies = false;
|
@@ -19,7 +20,6 @@ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
|
19
20
|
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
|
20
21
|
--
|
21
22
|
|
22
|
-
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
23
23
|
|
24
24
|
|
25
25
|
--
|
@@ -33,7 +33,6 @@ CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
|
|
33
33
|
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: -
|
34
34
|
--
|
35
35
|
|
36
|
-
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
|
37
36
|
|
38
37
|
|
39
38
|
--
|
data/template/lib/routes.rb
CHANGED
@@ -3,7 +3,7 @@ Routes = Rack::Builder.new do
|
|
3
3
|
use Pliny::Middleware::CORS
|
4
4
|
use Pliny::Middleware::RequestID
|
5
5
|
use Pliny::Middleware::RequestStore, store: Pliny::RequestStore
|
6
|
-
use Pliny::Middleware::Timeout, timeout: Config.timeout
|
6
|
+
use Pliny::Middleware::Timeout, timeout: Config.timeout if Config.timeout > 0
|
7
7
|
use Pliny::Middleware::Versioning,
|
8
8
|
default: Config.versioning_default,
|
9
9
|
app_name: Config.versioning_app_name if Config.versioning?
|
@@ -11,7 +11,14 @@ class Serializers
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def serialize(object)
|
14
|
-
|
14
|
+
object.respond_to?(:map) ? object.map{|item| serializer.call(item)} : serializer.call(object)
|
15
15
|
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def serializer
|
20
|
+
@@structures["#{self.class.name}::#{@type}"]
|
21
|
+
end
|
22
|
+
|
16
23
|
end
|
17
24
|
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'pliny/commands/generator'
|
2
|
+
require 'pliny/commands/generator/base'
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
describe Pliny::Commands::Generator::Base do
|
6
|
+
subject { Pliny::Commands::Generator::Base.new(model_name, {}, StringIO.new) }
|
7
|
+
|
8
|
+
describe '#singular_class_name' do
|
9
|
+
let(:model_name) { 'resource_histories' }
|
10
|
+
|
11
|
+
it 'builds a class name for an endpoint' do
|
12
|
+
assert_equal 'ResourceHistory', subject.singular_class_name
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'when name with hypens' do
|
16
|
+
let(:model_name) { 'resource-histories' }
|
17
|
+
|
18
|
+
it 'handles hyphens as underscores' do
|
19
|
+
assert_equal 'ResourceHistory', subject.singular_class_name
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#plural_class_name' do
|
25
|
+
let(:model_name) { 'resource_histories' }
|
26
|
+
|
27
|
+
it 'builds a class name for a model' do
|
28
|
+
assert_equal 'ResourceHistories', subject.plural_class_name
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'when name with hypens' do
|
32
|
+
let(:model_name) { 'resource-histories' }
|
33
|
+
|
34
|
+
it 'handles hyphens as underscores' do
|
35
|
+
assert_equal 'ResourceHistories', subject.plural_class_name
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#field_name' do
|
41
|
+
let(:model_name) { 'resource_histories' }
|
42
|
+
|
43
|
+
it 'uses the singular form' do
|
44
|
+
assert_equal 'resource_history', subject.field_name
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'when name with hypens' do
|
48
|
+
let(:model_name) { 'resource-histories' }
|
49
|
+
|
50
|
+
it 'handles hyphens as underscores' do
|
51
|
+
assert_equal 'resource_history', subject.field_name
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#pluralized_file_name' do
|
57
|
+
let(:model_name) { 'resource_history' }
|
58
|
+
|
59
|
+
it 'uses the plural form' do
|
60
|
+
assert_equal 'resource_histories', subject.pluralized_file_name
|
61
|
+
end
|
62
|
+
|
63
|
+
describe 'when name with hypens' do
|
64
|
+
let(:model_name) { 'resource-history' }
|
65
|
+
|
66
|
+
it 'handles hyphens as underscores' do
|
67
|
+
assert_equal 'resource_histories', subject.pluralized_file_name
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe 'when name with slashs' do
|
72
|
+
let(:model_name) { 'resource/history' }
|
73
|
+
|
74
|
+
it 'handles slashs as directory' do
|
75
|
+
assert_equal 'resource/histories', subject.pluralized_file_name
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#table_name' do
|
81
|
+
let(:model_name) { 'resource_history' }
|
82
|
+
|
83
|
+
it 'uses the plural form' do
|
84
|
+
assert_equal 'resource_histories', subject.table_name
|
85
|
+
end
|
86
|
+
|
87
|
+
describe 'when name with hypens' do
|
88
|
+
let(:model_name) { 'resource-history' }
|
89
|
+
|
90
|
+
it 'handles hyphens as underscores' do
|
91
|
+
assert_equal 'resource_histories', subject.table_name
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe 'when name with slashs' do
|
96
|
+
let(:model_name) { 'resource/history' }
|
97
|
+
|
98
|
+
it 'handles slashs as underscores' do
|
99
|
+
assert_equal 'resource_histories', subject.table_name
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'pliny/commands/generator'
|
2
|
+
require 'pliny/commands/generator/endpoint'
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
describe Pliny::Commands::Generator::Endpoint do
|
6
|
+
subject { Pliny::Commands::Generator::Endpoint.new(model_name, {}, StringIO.new) }
|
7
|
+
|
8
|
+
describe '#url_path' do
|
9
|
+
let(:model_name) { 'resource_history' }
|
10
|
+
|
11
|
+
it 'builds a URL path' do
|
12
|
+
assert_equal '/resource-histories', subject.url_path
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,197 +1,158 @@
|
|
1
|
-
require
|
1
|
+
require 'pliny/commands/generator'
|
2
|
+
require 'pliny/commands/generator/base'
|
3
|
+
require 'test_helper'
|
2
4
|
|
3
5
|
describe Pliny::Commands::Generator do
|
4
|
-
|
5
|
-
@gen = Pliny::Commands::Generator.new({}, {}, StringIO.new)
|
6
|
-
end
|
6
|
+
subject { Pliny::Commands::Generator.new }
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
8
|
+
before do
|
9
|
+
FileUtils.mkdir_p('/tmp/plinytest')
|
10
|
+
Dir.chdir('/tmp/plinytest')
|
11
|
+
Timecop.freeze(@t = Time.now)
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
assert_equal "resource_history", @gen.field_name
|
13
|
+
any_instance_of(Pliny::Commands::Generator::Base) do |klass|
|
14
|
+
stub(klass).display
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
assert_equal "ResourceHistories", @gen.plural_class_name
|
24
|
-
end
|
25
|
-
|
26
|
-
it "handles hyphens as underscores" do
|
27
|
-
@gen.args = ["model", "resource-histories"]
|
28
|
-
assert_equal "ResourceHistories", @gen.plural_class_name
|
29
|
-
end
|
18
|
+
after do
|
19
|
+
FileUtils.rmdir('/tmp/plinytest')
|
20
|
+
Timecop.return
|
30
21
|
end
|
31
22
|
|
32
|
-
describe
|
33
|
-
|
34
|
-
|
35
|
-
assert_equal "ResourceHistory", @gen.singular_class_name
|
23
|
+
describe '#endpoint' do
|
24
|
+
before do
|
25
|
+
subject.endpoint('artists')
|
36
26
|
end
|
37
27
|
|
38
|
-
it
|
39
|
-
|
40
|
-
assert_equal "ResourceHistory", @gen.singular_class_name
|
28
|
+
it 'creates a new endpoint module' do
|
29
|
+
assert File.exist?('lib/endpoints/artists.rb')
|
41
30
|
end
|
42
|
-
end
|
43
31
|
|
44
|
-
|
45
|
-
|
46
|
-
@gen.args = ["model", "resource_history"]
|
47
|
-
assert_equal "resource_histories", @gen.table_name
|
32
|
+
it 'creates an endpoint test' do
|
33
|
+
assert File.exist?('spec/endpoints/artists_spec.rb')
|
48
34
|
end
|
49
35
|
|
50
|
-
it
|
51
|
-
|
52
|
-
assert_equal "resource_histories", @gen.table_name
|
36
|
+
it 'creates an endpoint acceptance test' do
|
37
|
+
assert File.exist?('spec/acceptance/artists_spec.rb')
|
53
38
|
end
|
54
39
|
end
|
55
40
|
|
56
|
-
describe
|
41
|
+
describe '#mediator' do
|
57
42
|
before do
|
58
|
-
|
59
|
-
Dir.chdir("/tmp/plinytest")
|
60
|
-
Timecop.freeze(@t=Time.now)
|
43
|
+
subject.mediator('artists/creator')
|
61
44
|
end
|
62
45
|
|
63
|
-
|
64
|
-
|
65
|
-
Timecop.return
|
46
|
+
it 'creates a new mediator module' do
|
47
|
+
assert File.exist?('lib/mediators/artists/creator.rb')
|
66
48
|
end
|
67
49
|
|
68
|
-
|
69
|
-
|
70
|
-
@gen.args = ["endpoint", "artists"]
|
71
|
-
@gen.run!
|
72
|
-
end
|
73
|
-
|
74
|
-
it "creates a new endpoint module" do
|
75
|
-
assert File.exists?("lib/endpoints/artists.rb")
|
76
|
-
end
|
77
|
-
|
78
|
-
it "creates an endpoint test" do
|
79
|
-
assert File.exists?("spec/endpoints/artists_spec.rb")
|
80
|
-
end
|
81
|
-
|
82
|
-
it "creates an endpoint acceptance test" do
|
83
|
-
assert File.exists?("spec/acceptance/artists_spec.rb")
|
84
|
-
end
|
50
|
+
it 'creates a test' do
|
51
|
+
assert File.exist?('spec/mediators/artists/creator_spec.rb')
|
85
52
|
end
|
53
|
+
end
|
86
54
|
|
87
|
-
|
55
|
+
describe '#model' do
|
56
|
+
describe 'simple model' do
|
88
57
|
before do
|
89
|
-
|
90
|
-
@gen.run!
|
58
|
+
subject.model('artist')
|
91
59
|
end
|
92
60
|
|
93
|
-
it
|
94
|
-
assert File.
|
61
|
+
it 'creates a migration' do
|
62
|
+
assert File.exist?("db/migrate/#{@t.to_i}_create_artists.rb")
|
95
63
|
end
|
96
64
|
|
97
|
-
it
|
98
|
-
assert File.
|
65
|
+
it 'creates the actual model' do
|
66
|
+
assert File.exist?('lib/models/artist.rb')
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'creates a test' do
|
70
|
+
assert File.exist?('spec/models/artist_spec.rb')
|
99
71
|
end
|
100
72
|
end
|
101
73
|
|
102
|
-
describe
|
74
|
+
describe 'model in nested class' do
|
103
75
|
before do
|
104
|
-
|
105
|
-
@gen.run!
|
76
|
+
subject.model('administration/user')
|
106
77
|
end
|
107
78
|
|
108
|
-
it
|
109
|
-
assert File.
|
79
|
+
it 'creates a migration' do
|
80
|
+
assert File.exist?("db/migrate/#{@t.to_i}_create_administration_users.rb")
|
110
81
|
end
|
111
82
|
|
112
|
-
it
|
113
|
-
assert File.
|
83
|
+
it 'creates the actual model' do
|
84
|
+
assert File.exist?('lib/models/administration/user.rb')
|
114
85
|
end
|
115
86
|
|
116
|
-
it
|
117
|
-
assert File.
|
87
|
+
it 'creates a test' do
|
88
|
+
assert File.exist?('spec/models/administration/user_spec.rb')
|
118
89
|
end
|
119
90
|
end
|
91
|
+
end
|
120
92
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
end
|
126
|
-
|
127
|
-
it "creates a new endpoint module" do
|
128
|
-
assert File.exists?("lib/endpoints/artists.rb")
|
129
|
-
end
|
93
|
+
describe '#scaffold' do
|
94
|
+
before do
|
95
|
+
subject.scaffold('artist')
|
96
|
+
end
|
130
97
|
|
131
|
-
|
132
|
-
|
133
|
-
|
98
|
+
it 'creates a new endpoint module' do
|
99
|
+
assert File.exist?('lib/endpoints/artists.rb')
|
100
|
+
end
|
134
101
|
|
135
|
-
|
136
|
-
|
137
|
-
|
102
|
+
it 'creates an endpoint test' do
|
103
|
+
assert File.exist?('spec/endpoints/artists_spec.rb')
|
104
|
+
end
|
138
105
|
|
139
|
-
|
140
|
-
|
141
|
-
|
106
|
+
it 'creates an endpoint acceptance test' do
|
107
|
+
assert File.exist?('spec/acceptance/artists_spec.rb')
|
108
|
+
end
|
142
109
|
|
143
|
-
|
144
|
-
|
145
|
-
|
110
|
+
it 'creates a migration' do
|
111
|
+
assert File.exist?("db/migrate/#{@t.to_i}_create_artists.rb")
|
112
|
+
end
|
146
113
|
|
147
|
-
|
148
|
-
|
149
|
-
|
114
|
+
it 'creates the actual model' do
|
115
|
+
assert File.exist?('lib/models/artist.rb')
|
116
|
+
end
|
150
117
|
|
151
|
-
|
152
|
-
|
153
|
-
|
118
|
+
it 'creates a test' do
|
119
|
+
assert File.exist?('spec/models/artist_spec.rb')
|
120
|
+
end
|
154
121
|
|
155
|
-
|
156
|
-
|
157
|
-
|
122
|
+
it 'creates a schema' do
|
123
|
+
assert File.exist?('docs/schema/schemata/artist.yaml')
|
124
|
+
end
|
158
125
|
|
159
|
-
|
160
|
-
|
161
|
-
end
|
126
|
+
it 'creates a new serializer module' do
|
127
|
+
assert File.exist?('lib/serializers/artist.rb')
|
162
128
|
end
|
163
129
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
end
|
130
|
+
it 'creates a test' do
|
131
|
+
assert File.exist?('spec/serializers/artist_spec.rb')
|
132
|
+
end
|
133
|
+
end
|
169
134
|
|
170
|
-
|
171
|
-
|
172
|
-
|
135
|
+
describe '#schema' do
|
136
|
+
before do
|
137
|
+
subject.schema('artist')
|
173
138
|
end
|
174
139
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
end
|
140
|
+
it 'creates a schema' do
|
141
|
+
assert File.exist?('docs/schema/schemata/artist.yaml')
|
142
|
+
end
|
143
|
+
end
|
180
144
|
|
181
|
-
|
182
|
-
|
183
|
-
|
145
|
+
describe '#serializer' do
|
146
|
+
before do
|
147
|
+
subject.serializer('artist')
|
148
|
+
end
|
184
149
|
|
185
|
-
|
186
|
-
|
187
|
-
end
|
150
|
+
it 'creates a new serializer module' do
|
151
|
+
assert File.exist?('lib/serializers/artist.rb')
|
188
152
|
end
|
189
|
-
end
|
190
153
|
|
191
|
-
|
192
|
-
|
193
|
-
@gen.args = ["endpoint", "resource_history"]
|
194
|
-
assert_equal "/resource-histories", @gen.url_path
|
154
|
+
it 'creates a test' do
|
155
|
+
assert File.exist?('spec/serializers/artist_spec.rb')
|
195
156
|
end
|
196
157
|
end
|
197
158
|
end
|