Skip to content

Commit 9ffacf7

Browse files
authored
Merge pull request #574 from pixeltrix/fix-warnings-and-version-constant
Fix warnings and prevent Jbuilder::VERSION constant from being obliterated
2 parents d23ebe2 + f447b60 commit 9ffacf7

File tree

11 files changed

+31
-13
lines changed

11 files changed

+31
-13
lines changed

.github/workflows/ruby.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,19 @@ jobs:
2424
gemfile:
2525
- "rails_7_0"
2626
- "rails_7_1"
27+
- "rails_7_2"
2728
- "rails_8_0"
2829
- "rails_head"
2930

3031
exclude:
32+
- ruby: '3.0'
33+
gemfile: rails_7_2
3134
- ruby: '3.0'
3235
gemfile: rails_8_0
3336
- ruby: '3.0'
3437
gemfile: rails_head
38+
- ruby: '3.1'
39+
gemfile: rails_7_2
3540
- ruby: '3.1'
3641
gemfile: rails_8_0
3742
- ruby: '3.1'

Appraisals

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ appraise "rails-7-1" do
99
gem "rails", "~> 7.1.0"
1010
end
1111

12+
appraise "rails-7-2" do
13+
gem "rails", "~> 7.2.0"
14+
end
15+
1216
appraise "rails-8-0" do
1317
gem "rails", "~> 8.0.0"
1418
end

bin/test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env bash
1+
#!/usr/bin/env bash
22
set -e
33

44
bundle install

gemfiles/rails_7_2.gemfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "rake"
6+
gem "mocha", require: false
7+
gem "appraisal"
8+
gem "rails", "~> 7.2.0"
9+
10+
gemspec path: "../"

lib/jbuilder.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
require 'jbuilder/blank'
66
require 'jbuilder/key_formatter'
77
require 'jbuilder/errors'
8-
require 'jbuilder/version'
98
require 'json'
109
require 'active_support/core_ext/hash/deep_merge'
1110

lib/jbuilder/errors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'jbuilder/jbuilder'
3+
require 'jbuilder/version'
44

55
class Jbuilder
66
class NullError < ::NoMethodError

lib/jbuilder/jbuilder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# frozen_string_literal: true
22

3-
Jbuilder = Class.new(BasicObject)
3+
require 'jbuilder/version'

lib/jbuilder/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

3-
class Jbuilder
3+
class Jbuilder < BasicObject
44
VERSION = "2.13.0"
55
end

test/scaffold_api_controller_generator_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class ScaffoldApiControllerGeneratorTest < Rails::Generators::TestCase
66
tests Rails::Generators::ScaffoldControllerGenerator
7-
arguments %w(Post title body:text images:attachments --api)
7+
arguments %w(Post title body:text images:attachments --api --skip-routes)
88
destination File.expand_path('../tmp', __FILE__)
99
setup :prepare_destination
1010

@@ -53,7 +53,7 @@ class ScaffoldApiControllerGeneratorTest < Rails::Generators::TestCase
5353
end
5454

5555
test "don't use require and permit if there are no attributes" do
56-
run_generator %w(Post --api)
56+
run_generator %w(Post --api --skip-routes)
5757

5858
assert_file 'app/controllers/posts_controller.rb' do |content|
5959
assert_match %r{def post_params}, content
@@ -62,7 +62,7 @@ class ScaffoldApiControllerGeneratorTest < Rails::Generators::TestCase
6262
end
6363

6464
test 'handles virtual attributes' do
65-
run_generator ["Message", "content:rich_text", "video:attachment", "photos:attachments"]
65+
run_generator %w(Message content:rich_text video:attachment photos:attachments --skip-routes)
6666

6767
assert_file 'app/controllers/messages_controller.rb' do |content|
6868
if Rails::VERSION::MAJOR >= 8

test/scaffold_controller_generator_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
66
tests Rails::Generators::ScaffoldControllerGenerator
7-
arguments %w(Post title body:text images:attachments)
7+
arguments %w(Post title body:text images:attachments --skip-routes)
88
destination File.expand_path('../tmp', __FILE__)
99
setup :prepare_destination
1010

@@ -67,7 +67,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
6767
end
6868

6969
test 'controller with namespace' do
70-
run_generator %w(Admin::Post --model-name=Post)
70+
run_generator %w(Admin::Post --model-name=Post --skip-routes)
7171
assert_file 'app/controllers/admin/posts_controller.rb' do |content|
7272
assert_instance_method :create, content do |m|
7373
assert_match %r{format\.html \{ redirect_to \[:admin, @post\], notice: "Post was successfully created\." \}}, m
@@ -84,7 +84,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
8484
end
8585

8686
test "don't use require and permit if there are no attributes" do
87-
run_generator %w(Post)
87+
run_generator %w(Post --skip-routes)
8888

8989
assert_file 'app/controllers/posts_controller.rb' do |content|
9090
assert_match %r{def post_params}, content
@@ -93,7 +93,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
9393
end
9494

9595
test 'handles virtual attributes' do
96-
run_generator %w(Message content:rich_text video:attachment photos:attachments)
96+
run_generator %w(Message content:rich_text video:attachment photos:attachments --skip-routes)
9797

9898
assert_file 'app/controllers/messages_controller.rb' do |content|
9999
if Rails::VERSION::MAJOR >= 8

0 commit comments

Comments
 (0)