Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Load plugin VERSION constant by default
For example, for a plugin like `my_plugin`, this makes the `MyPlugin::VERSION` constant available to all consumers by default. This commit also replaces the default generated test with a test that the developer is less likely to delete.
- Loading branch information
1 parent
6b359ce
commit f243470
Showing
3 changed files
with
8 additions
and
4 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
require "<%= namespaced_name %>/version" | ||
<% if engine? -%> | ||
require "<%= namespaced_name %>/engine" | ||
<% else -%> | ||
|
4 changes: 2 additions & 2 deletions
4
railties/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
require "test_helper" | ||
|
||
class <%= camelized_modules %>Test < ActiveSupport::TestCase | ||
test "truth" do | ||
assert_kind_of Module, <%= camelized_modules %> | ||
test "it has a version number" do | ||
assert <%= camelized_modules %>::VERSION | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters