-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lotus::View.load! now freezes framework, views and layouts configurat…
…ions
- Loading branch information
Showing
7 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -99,6 +99,7 @@ def suffix | |
# @see Lotus::View.load! | ||
def load! | ||
registry.freeze | ||
configuration.freeze | ||
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
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
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 |
---|---|---|
|
@@ -318,6 +318,7 @@ def load! | |
v.format.freeze | ||
v.template.freeze | ||
v.layout#.freeze | ||
v.configuration.freeze | ||
end | ||
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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require 'test_helper' | ||
|
||
describe 'Framework freeze' do | ||
describe 'Lotus::View' do | ||
before do | ||
Lotus::View.load! | ||
end | ||
|
||
it 'freezes framework configuration' do | ||
Lotus::View.configuration.must_be :frozen? | ||
end | ||
|
||
it 'freezes view configuration' do | ||
AppView.configuration.must_be :frozen? | ||
end | ||
|
||
it 'freezes view subclass configuration' do | ||
AppViewLayout.configuration.must_be :frozen? | ||
end | ||
|
||
it 'freezes layout configuration' do | ||
ApplicationLayout.configuration.must_be :frozen? | ||
end | ||
end | ||
|
||
describe 'duplicated framework' do | ||
before do | ||
Store::View.load! | ||
end | ||
|
||
it 'freezes framework configuration' do | ||
Store::View.configuration.must_be :frozen? | ||
end | ||
|
||
it 'freezes view configuration' do | ||
Store::Views::Home::Index.configuration.must_be :frozen? | ||
end | ||
|
||
it 'freezes view subclass configuration' do | ||
Store::Views::Home::JsonIndex.configuration.must_be :frozen? | ||
end | ||
|
||
it 'freezes layout configuration' do | ||
Store::Views::StoreLayout.configuration.must_be :frozen? | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
end | ||
|
||
require 'fixtures' | ||
Lotus::View.load! | ||
|
||
Lotus::Utils::LoadPaths.class_eval do | ||
def include?(object) | ||
|