pliny 1.2.0 → 2.0.0

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.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/bin/pliny-generate +2 -1
  3. data/bin/pliny-new +2 -1
  4. data/bin/pliny-update +2 -1
  5. data/lib/pliny/canonical_log_line_helpers.rb +2 -0
  6. data/lib/pliny/commands/creator.rb +13 -12
  7. data/lib/pliny/commands/generator/base.rb +11 -9
  8. data/lib/pliny/commands/generator/endpoint.rb +19 -17
  9. data/lib/pliny/commands/generator/mediator.rb +7 -5
  10. data/lib/pliny/commands/generator/migration.rb +4 -2
  11. data/lib/pliny/commands/generator/model.rb +11 -9
  12. data/lib/pliny/commands/generator/schema.rb +4 -2
  13. data/lib/pliny/commands/generator/serializer.rb +7 -5
  14. data/lib/pliny/commands/generator.rb +19 -17
  15. data/lib/pliny/commands/updater.rb +5 -3
  16. data/lib/pliny/config_helpers.rb +10 -35
  17. data/lib/pliny/db_support.rb +21 -21
  18. data/lib/pliny/error_reporters/rollbar.rb +5 -3
  19. data/lib/pliny/error_reporters/sentry.rb +40 -0
  20. data/lib/pliny/error_reporters.rb +5 -5
  21. data/lib/pliny/errors.rb +46 -44
  22. data/lib/pliny/helpers/encode.rb +4 -2
  23. data/lib/pliny/helpers/params.rb +2 -0
  24. data/lib/pliny/helpers/serialize.rb +6 -4
  25. data/lib/pliny/helpers/zulu_time.rb +3 -1
  26. data/lib/pliny/log.rb +26 -25
  27. data/lib/pliny/metrics/backends/logger.rb +5 -3
  28. data/lib/pliny/metrics.rb +4 -2
  29. data/lib/pliny/middleware/canonical_log_line.rb +5 -3
  30. data/lib/pliny/middleware/cors.rb +13 -12
  31. data/lib/pliny/middleware/instruments.rb +9 -7
  32. data/lib/pliny/middleware/metrics.rb +3 -1
  33. data/lib/pliny/middleware/request_id.rb +4 -2
  34. data/lib/pliny/middleware/request_store/clear.rb +3 -1
  35. data/lib/pliny/middleware/request_store/seed.rb +3 -1
  36. data/lib/pliny/middleware/rescue_errors.rb +2 -0
  37. data/lib/pliny/middleware/versioning.rb +11 -11
  38. data/lib/pliny/request_store.rb +4 -2
  39. data/lib/pliny/rollbar_logger.rb +6 -4
  40. data/lib/pliny/router.rb +3 -2
  41. data/lib/pliny/tasks/db.rake +3 -1
  42. data/lib/pliny/tasks/schema.rake +3 -1
  43. data/lib/pliny/tasks.rb +2 -0
  44. data/lib/pliny/utils.rb +4 -2
  45. data/lib/pliny/version.rb +3 -1
  46. data/lib/pliny.rb +2 -0
  47. data/lib/template/{.rubocop.yml → .rubocop_template.yml} +1 -5
  48. data/lib/template/Gemfile +7 -4
  49. data/lib/template/Rakefile +1 -0
  50. data/lib/template/bin/console +2 -1
  51. data/lib/template/bin/run +4 -1
  52. data/lib/template/config/config.rb +18 -16
  53. data/lib/template/config/initializers/database.rb +4 -2
  54. data/lib/template/config/initializers/log.rb +2 -0
  55. data/lib/template/config/initializers/metrics.rb +2 -0
  56. data/lib/template/config/initializers/sentry.rb +14 -0
  57. data/lib/template/config/puma.rb +3 -1
  58. data/lib/template/config.ru +2 -0
  59. data/lib/template/db/seeds.rb +2 -0
  60. data/lib/template/lib/application.rb +2 -0
  61. data/lib/template/lib/endpoints/base.rb +2 -0
  62. data/lib/template/lib/endpoints/health.rb +2 -0
  63. data/lib/template/lib/endpoints/root.rb +2 -0
  64. data/lib/template/lib/endpoints/schema.rb +2 -0
  65. data/lib/template/lib/initializer.rb +6 -4
  66. data/lib/template/lib/mediators/base.rb +2 -0
  67. data/lib/template/lib/routes.rb +8 -6
  68. data/lib/template/lib/serializers/base.rb +2 -0
  69. data/lib/template/lib/tasks/rubocop.rake +2 -0
  70. data/lib/template/lib/tasks/spec.rake +2 -1
  71. data/lib/template/spec/endpoints/health_spec.rb +2 -0
  72. data/lib/template/spec/endpoints/schema_spec.rb +2 -0
  73. data/lib/template/spec/spec_helper.rb +2 -0
  74. data/lib/template/spec/spec_support/auto_define_rack_app.rb +2 -0
  75. data/lib/template/spec/spec_support/coverage.rb +2 -0
  76. data/lib/template/spec/spec_support/log.rb +2 -0
  77. data/spec/canonical_log_line_helpers_spec.rb +10 -8
  78. data/spec/commands/creator_spec.rb +3 -0
  79. data/spec/commands/generator/base_spec.rb +61 -59
  80. data/spec/commands/generator/endpoint_spec.rb +16 -15
  81. data/spec/commands/generator/mediator_spec.rb +11 -9
  82. data/spec/commands/generator/migration_spec.rb +7 -5
  83. data/spec/commands/generator/model_spec.rb +13 -11
  84. data/spec/commands/generator/schema_spec.rb +29 -28
  85. data/spec/commands/generator/serializer_spec.rb +11 -9
  86. data/spec/commands/generator_spec.rb +64 -62
  87. data/spec/commands/updater_spec.rb +2 -0
  88. data/spec/config_helpers_spec.rb +7 -85
  89. data/spec/db_support_spec.rb +46 -44
  90. data/spec/error_reporters/rollbar_spec.rb +8 -6
  91. data/spec/error_reporters/sentry_spec.rb +83 -0
  92. data/spec/error_reporters_spec.rb +4 -2
  93. data/spec/errors_spec.rb +4 -1
  94. data/spec/helpers/encode_spec.rb +2 -0
  95. data/spec/helpers/params_spec.rb +9 -7
  96. data/spec/helpers/serialize_spec.rb +11 -7
  97. data/spec/helpers/zulu_time_spec.rb +6 -4
  98. data/spec/integration_spec.rb +14 -12
  99. data/spec/log_spec.rb +8 -6
  100. data/spec/metrics/backends/logger_spec.rb +10 -6
  101. data/spec/metrics_spec.rb +15 -13
  102. data/spec/middleware/canonical_log_line_spec.rb +5 -2
  103. data/spec/middleware/cors_spec.rb +2 -0
  104. data/spec/middleware/instruments_spec.rb +10 -8
  105. data/spec/middleware/metrics_spec.rb +3 -1
  106. data/spec/middleware/request_id_spec.rb +2 -0
  107. data/spec/middleware/request_store/clear_spec.rb +2 -0
  108. data/spec/middleware/request_store/seed_spec.rb +2 -0
  109. data/spec/middleware/rescue_errors_spec.rb +13 -13
  110. data/spec/middleware/versioning_spec.rb +22 -20
  111. data/spec/request_store_spec.rb +3 -1
  112. data/spec/rollbar_logger_spec.rb +11 -9
  113. data/spec/router_spec.rb +9 -7
  114. data/spec/spec_helper.rb +3 -1
  115. data/spec/support/config.rb +2 -0
  116. data/spec/support/endpoints.rb +2 -0
  117. metadata +91 -100
  118. data/lib/template/config/initializers/rollbar.rb +0 -12
@@ -1,120 +1,122 @@
1
- require 'pliny/commands/generator'
2
- require 'pliny/commands/generator/base'
3
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "pliny/commands/generator"
4
+ require "pliny/commands/generator/base"
5
+ require "spec_helper"
4
6
 
5
7
  describe Pliny::Commands::Generator::Base do
6
8
  def generator(name, options = {}, stream = StringIO.new)
7
9
  Pliny::Commands::Generator::Base.new(name, options, stream)
8
10
  end
9
11
 
10
- describe '#name' do
11
- it 'generates a normalized name given differents argument formats' do
12
+ describe "#name" do
13
+ it "generates a normalized name given differents argument formats" do
12
14
  [
13
- 'resource history',
14
- 'resource-history',
15
- 'resource_history',
16
- 'ResourceHistory'
15
+ "resource history",
16
+ "resource-history",
17
+ "resource_history",
18
+ "ResourceHistory",
17
19
  ].each do |argument|
18
20
  actual = generator(argument).name
19
- assert_equal 'resource_history', actual
21
+ assert_equal "resource_history", actual
20
22
  end
21
23
  end
22
24
  end
23
25
 
24
- describe '#singular_class_name' do
25
- it 'builds a class name for an endpoint' do
26
- actual = generator('resource_histories').singular_class_name
27
- assert_equal 'ResourceHistory', actual
26
+ describe "#singular_class_name" do
27
+ it "builds a class name for an endpoint" do
28
+ actual = generator("resource_histories").singular_class_name
29
+ assert_equal "ResourceHistory", actual
28
30
  end
29
31
  end
30
32
 
31
- describe '#plural_class_name' do
32
- it 'builds a class name for a model' do
33
- actual = generator('resource_histories').plural_class_name
34
- assert_equal 'ResourceHistories', actual
33
+ describe "#plural_class_name" do
34
+ it "builds a class name for a model" do
35
+ actual = generator("resource_histories").plural_class_name
36
+ assert_equal "ResourceHistories", actual
35
37
  end
36
38
  end
37
39
 
38
- describe '#field_name' do
39
- it 'uses the singular form' do
40
- actual = generator('resource_histories').field_name
41
- assert_equal 'resource_history', actual
40
+ describe "#field_name" do
41
+ it "uses the singular form" do
42
+ actual = generator("resource_histories").field_name
43
+ assert_equal "resource_history", actual
42
44
  end
43
45
  end
44
46
 
45
- describe '#pluralized_file_name' do
46
- it 'uses the plural form' do
47
- actual = generator('resource_history').pluralized_file_name
48
- assert_equal 'resource_histories', actual
47
+ describe "#pluralized_file_name" do
48
+ it "uses the plural form" do
49
+ actual = generator("resource_history").pluralized_file_name
50
+ assert_equal "resource_histories", actual
49
51
  end
50
52
 
51
- describe 'when name with slashs' do
52
- it 'handles slashs as directory' do
53
- actual = generator('resource/history').pluralized_file_name
54
- assert_equal 'resource/histories', actual
53
+ describe "when name with slashs" do
54
+ it "handles slashs as directory" do
55
+ actual = generator("resource/history").pluralized_file_name
56
+ assert_equal "resource/histories", actual
55
57
  end
56
58
  end
57
59
  end
58
60
 
59
- describe '#table_name' do
60
- it 'uses the plural form' do
61
- actual = generator('resource_history').table_name
62
- assert_equal 'resource_histories', actual
61
+ describe "#table_name" do
62
+ it "uses the plural form" do
63
+ actual = generator("resource_history").table_name
64
+ assert_equal "resource_histories", actual
63
65
  end
64
66
 
65
- describe 'when name with slashs' do
66
- it 'handles slashs as underscores' do
67
- actual = generator('resource/history').table_name
68
- assert_equal 'resource_histories', actual
67
+ describe "when name with slashs" do
68
+ it "handles slashs as underscores" do
69
+ actual = generator("resource/history").table_name
70
+ assert_equal "resource_histories", actual
69
71
  end
70
72
  end
71
73
  end
72
74
 
73
- describe '#display' do
74
- it 'puts given message into stream' do
75
+ describe "#display" do
76
+ it "puts given message into stream" do
75
77
  stream = StringIO.new
76
- message = 'Hello world'
77
- generator('resource_history', {}, stream).display(message)
78
+ message = "Hello world"
79
+ generator("resource_history", {}, stream).display(message)
78
80
 
79
81
  assert_includes stream.string, message
80
82
  end
81
83
  end
82
84
 
83
- describe '#render_template' do
84
- it 'renders template into a string' do
85
- template = generator('resource_history').render_template('endpoint.erb')
86
- assert_match /module Endpoints/, template
85
+ describe "#render_template" do
86
+ it "renders template into a string" do
87
+ template = generator("resource_history").render_template("endpoint.erb")
88
+ assert_match(/module Endpoints/, template)
87
89
  end
88
90
  end
89
91
 
90
- describe '#write_template' do
91
- let(:destination_path) { File.join(Dir.mktmpdir, 'endpoint.rb') }
92
+ describe "#write_template" do
93
+ let(:destination_path) { File.join(Dir.mktmpdir, "endpoint.rb") }
92
94
 
93
95
  before do
94
- generator('resource_history').write_template('endpoint.erb', destination_path)
96
+ generator("resource_history").write_template("endpoint.erb", destination_path)
95
97
  end
96
98
 
97
- it 'renders given template into a file by given path' do
99
+ it "renders given template into a file by given path" do
98
100
  assert File.exist?(destination_path)
99
- assert_match /module Endpoints/, File.read(destination_path)
101
+ assert_match(/module Endpoints/, File.read(destination_path))
100
102
  end
101
103
  end
102
-
103
- describe '#write_file' do
104
- let(:destination_path) { File.join(Dir.mktmpdir, 'foo.txt') }
104
+
105
+ describe "#write_file" do
106
+ let(:destination_path) { File.join(Dir.mktmpdir, "foo.txt") }
105
107
 
106
108
  before do
107
- generator('resource_history').write_file(destination_path) do
108
- 'Hello world'
109
+ generator("resource_history").write_file(destination_path) do
110
+ "Hello world"
109
111
  end
110
112
  end
111
113
 
112
- it 'creates a file by given path' do
114
+ it "creates a file by given path" do
113
115
  assert File.exist?(destination_path)
114
116
  end
115
117
 
116
- it 'writes given content into a file' do
117
- assert_match /Hello world/, File.read(destination_path)
118
+ it "writes given content into a file" do
119
+ assert_match(/Hello world/, File.read(destination_path))
118
120
  end
119
121
  end
120
122
  end
@@ -1,26 +1,28 @@
1
- require 'pliny/commands/generator'
2
- require 'pliny/commands/generator/endpoint'
3
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "pliny/commands/generator"
4
+ require "pliny/commands/generator/endpoint"
5
+ require "spec_helper"
4
6
 
5
7
  describe Pliny::Commands::Generator::Endpoint do
6
8
  subject { Pliny::Commands::Generator::Endpoint.new(endpoint_name, {}, StringIO.new) }
7
- let(:endpoint_name) { 'resource_history' }
9
+ let(:endpoint_name) { "resource_history" }
8
10
 
9
- describe '#url_path' do
10
- it 'builds a URL path' do
11
- assert_equal '/resource-histories', subject.url_path
11
+ describe "#url_path" do
12
+ it "builds a URL path" do
13
+ assert_equal "/resource-histories", subject.url_path
12
14
  end
13
15
  end
14
16
 
15
- describe 'template' do
17
+ describe "template" do
16
18
  before do
17
19
  # render the stub endpoint template to a string
18
20
  template = subject.render_template("endpoint.erb",
19
21
  plural_class_name: "Artists",
20
- url_path: "/artists")
22
+ url_path: "/artists",)
21
23
 
22
24
  # eval and assign it to rack_app so tests are pointing to it
23
- @rack_app = eval(template)
25
+ @rack_app = eval(template) # rubocop:disable Security/Eval
24
26
  end
25
27
 
26
28
  it "defines a stub GET /" do
@@ -32,26 +34,25 @@ describe Pliny::Commands::Generator::Endpoint do
32
34
  it "defines a stub POST /" do
33
35
  post "/artists"
34
36
  assert_equal 201, last_response.status
35
- assert_equal Hash.new, JSON.parse(last_response.body)
37
+ assert_equal({}, JSON.parse(last_response.body))
36
38
  end
37
39
 
38
40
  it "defines a stub GET /:id" do
39
41
  get "/artists/123"
40
42
  assert_equal 200, last_response.status
41
- assert_equal Hash.new, JSON.parse(last_response.body)
43
+ assert_equal({}, JSON.parse(last_response.body))
42
44
  end
43
45
 
44
46
  it "defines a stub PATCH /:id" do
45
47
  patch "/artists/123"
46
48
  assert_equal 200, last_response.status
47
- assert_equal Hash.new, JSON.parse(last_response.body)
49
+ assert_equal({}, JSON.parse(last_response.body))
48
50
  end
49
51
 
50
52
  it "defines a stub DELETE /:id" do
51
53
  delete "/artists/123"
52
54
  assert_equal 200, last_response.status
53
- assert_equal Hash.new, JSON.parse(last_response.body)
55
+ assert_equal({}, JSON.parse(last_response.body))
54
56
  end
55
-
56
57
  end
57
58
  end
@@ -1,24 +1,26 @@
1
- require 'pliny/commands/generator/mediator'
2
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "pliny/commands/generator/mediator"
4
+ require "spec_helper"
3
5
 
4
6
  describe Pliny::Commands::Generator::Mediator do
5
- subject { described_class.new('creator', {}, StringIO.new) }
7
+ subject { described_class.new("creator", {}, StringIO.new) }
6
8
 
7
9
  around do |example|
8
10
  Dir.chdir(Dir.mktmpdir, &example)
9
11
  end
10
12
 
11
- describe '#create' do
12
- it 'creates a mediator file' do
13
+ describe "#create" do
14
+ it "creates a mediator file" do
13
15
  subject.create
14
- assert File.exist?('lib/mediators/creator.rb')
16
+ assert File.exist?("lib/mediators/creator.rb")
15
17
  end
16
18
  end
17
19
 
18
- describe '#create_test' do
19
- it 'creates a mediator test file' do
20
+ describe "#create_test" do
21
+ it "creates a mediator test file" do
20
22
  subject.create_test
21
- assert File.exist?('spec/mediators/creator_spec.rb')
23
+ assert File.exist?("spec/mediators/creator_spec.rb")
22
24
  end
23
25
  end
24
26
  end
@@ -1,15 +1,17 @@
1
- require 'pliny/commands/generator/migration'
2
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "pliny/commands/generator/migration"
4
+ require "spec_helper"
3
5
 
4
6
  describe Pliny::Commands::Generator::Migration do
5
- subject { described_class.new('create_artists', {}, StringIO.new) }
7
+ subject { described_class.new("create_artists", {}, StringIO.new) }
6
8
 
7
9
  around do |example|
8
10
  Dir.chdir(Dir.mktmpdir, &example)
9
11
  end
10
12
 
11
- describe '#create' do
12
- it 'creates a migration file' do
13
+ describe "#create" do
14
+ it "creates a migration file" do
13
15
  subject.create
14
16
  assert_equal 1, Dir.glob("db/migrate/*_create_artists.rb").size
15
17
  end
@@ -1,31 +1,33 @@
1
- require 'pliny/commands/generator/model'
2
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "pliny/commands/generator/model"
4
+ require "spec_helper"
3
5
 
4
6
  describe Pliny::Commands::Generator::Model do
5
- subject { described_class.new('artist', {}, StringIO.new) }
7
+ subject { described_class.new("artist", {}, StringIO.new) }
6
8
 
7
9
  around do |example|
8
10
  Dir.chdir(Dir.mktmpdir, &example)
9
11
  end
10
12
 
11
- describe '#create' do
12
- it 'creates a model file' do
13
+ describe "#create" do
14
+ it "creates a model file" do
13
15
  subject.create
14
- assert File.exist?('lib/models/artist.rb')
16
+ assert File.exist?("lib/models/artist.rb")
15
17
  end
16
18
  end
17
19
 
18
- describe '#create_migration' do
19
- it 'creates a migration file' do
20
+ describe "#create_migration" do
21
+ it "creates a migration file" do
20
22
  subject.create_migration
21
23
  assert_equal 1, Dir.glob("db/migrate/*_create_artists.rb").size
22
24
  end
23
25
  end
24
26
 
25
- describe '#create_test' do
26
- it 'creates a model test file' do
27
+ describe "#create_test" do
28
+ it "creates a model test file" do
27
29
  subject.create_test
28
- assert File.exist?('spec/models/artist_spec.rb')
30
+ assert File.exist?("spec/models/artist_spec.rb")
29
31
  end
30
32
  end
31
33
  end
@@ -1,11 +1,13 @@
1
- require 'pliny/commands/creator'
2
- require 'pliny/commands/generator'
3
- require 'pliny/commands/generator/schema'
4
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "pliny/commands/creator"
4
+ require "pliny/commands/generator"
5
+ require "pliny/commands/generator/schema"
6
+ require "spec_helper"
5
7
 
6
8
  describe Pliny::Commands::Generator::Schema do
7
9
  let(:stream) { StringIO.new }
8
- subject { Pliny::Commands::Generator::Schema.new('artist', {}, stream) }
10
+ subject { Pliny::Commands::Generator::Schema.new("artist", {}, stream) }
9
11
 
10
12
  around do |example|
11
13
  Dir.mktmpdir do |dir|
@@ -16,66 +18,65 @@ describe Pliny::Commands::Generator::Schema do
16
18
  end
17
19
  end
18
20
 
19
-
20
- describe '#create' do
21
- context 'with new layout' do
21
+ describe "#create" do
22
+ context "with new layout" do
22
23
  before do
23
24
  subject.create
24
25
  end
25
26
 
26
- it 'creates a schema' do
27
- assert File.exist?('schema/schemata/artist.yaml')
27
+ it "creates a schema" do
28
+ assert File.exist?("schema/schemata/artist.yaml")
28
29
  end
29
30
  end
30
31
 
31
- context 'with legacy layout' do
32
+ context "with legacy layout" do
32
33
  before do
33
- FileUtils.mkdir_p('./docs/schema/schemata')
34
- FileUtils.cp('./schema/meta.json', './docs/schema')
34
+ FileUtils.mkdir_p("./docs/schema/schemata")
35
+ FileUtils.cp("./schema/meta.json", "./docs/schema")
35
36
  subject.create
36
37
  end
37
38
 
38
- it 'creates a legacy schema' do
39
- assert File.exist?('docs/schema/schemata/artist.yaml')
39
+ it "creates a legacy schema" do
40
+ assert File.exist?("docs/schema/schemata/artist.yaml")
40
41
  end
41
42
 
42
- it 'warns' do
43
+ it "warns" do
43
44
  assert_match(/WARNING/m, stream.string)
44
45
  end
45
46
  end
46
47
  end
47
48
 
48
- describe '#rebuild' do
49
- context 'with nil as the name argument (as used in schema.rake)' do
50
- it 'rebuilds the schema with prmd' do
49
+ describe "#rebuild" do
50
+ context "with nil as the name argument (as used in schema.rake)" do
51
+ it "rebuilds the schema with prmd" do
51
52
  assert_output(/rebuilt/) do
52
53
  Pliny::Commands::Generator::Schema.new(nil).rebuild
53
54
  end
54
55
  end
55
56
  end
56
57
 
57
- context 'with new layout' do
58
+ context "with new layout" do
58
59
  before do
59
60
  subject.rebuild
60
61
  end
61
62
 
62
- it 'rebuilds schema.json' do
63
- assert File.exist?('./schema/schema.json')
63
+ it "rebuilds schema.json" do
64
+ assert File.exist?("./schema/schema.json")
64
65
  end
65
66
  end
66
67
 
67
- context 'with legacy layout' do
68
+ context "with legacy layout" do
68
69
  before do
69
- FileUtils.mkdir_p('./docs/schema/schemata')
70
- FileUtils.cp('./schema/meta.json', './docs/schema')
70
+ FileUtils.mkdir_p("./docs/schema/schemata")
71
+ FileUtils.cp("./schema/meta.json", "./docs/schema")
71
72
  subject.rebuild
72
73
  end
73
74
 
74
- it 'rebuilds legacy schema.json' do
75
- assert File.exist?('docs/schema.json')
75
+ it "rebuilds legacy schema.json" do
76
+ assert File.exist?("docs/schema.json")
76
77
  end
77
78
 
78
- it 'warns' do
79
+ it "warns" do
79
80
  assert_match(/WARNING/m, stream.string)
80
81
  end
81
82
  end
@@ -1,24 +1,26 @@
1
- require 'pliny/commands/generator/serializer'
2
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "pliny/commands/generator/serializer"
4
+ require "spec_helper"
3
5
 
4
6
  describe Pliny::Commands::Generator::Serializer do
5
- subject { described_class.new('artist', {}, StringIO.new) }
7
+ subject { described_class.new("artist", {}, StringIO.new) }
6
8
 
7
9
  around do |example|
8
10
  Dir.chdir(Dir.mktmpdir, &example)
9
11
  end
10
12
 
11
- describe '#create' do
12
- it 'creates a serializer file' do
13
+ describe "#create" do
14
+ it "creates a serializer file" do
13
15
  subject.create
14
- assert File.exist?('lib/serializers/artist.rb')
16
+ assert File.exist?("lib/serializers/artist.rb")
15
17
  end
16
18
  end
17
19
 
18
- describe '#create_test' do
19
- it 'creates a serializer test file' do
20
+ describe "#create_test" do
21
+ it "creates a serializer test file" do
20
22
  subject.create_test
21
- assert File.exist?('spec/serializers/artist_spec.rb')
23
+ assert File.exist?("spec/serializers/artist_spec.rb")
22
24
  end
23
25
  end
24
26
  end