New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Processes ERB in yaml config files for page layouts, cells, and elements #760
Changes from 3 commits
4949e0d
4aad581
599d3b0
455833b
eac6a20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
- name: right_column | ||
elements: [search] | ||
|
||
- name: <%= 'erb_' + 'cell' %> | ||
elements: [text] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,6 @@ | |
- name: external | ||
unique: false | ||
redirects_to_external: true | ||
|
||
- name: <%= 'erb_' + 'layout' %> | ||
unique: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,10 @@ module Alchemy | |
it "should return an Array" do | ||
expect(Cell.definitions).to be_a(Array) | ||
end | ||
|
||
it "should allow erb generated definitions" do | ||
expect(Cell.definitions.collect {|d| d['name']}).to include('erb_cell') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer |
||
end | ||
end | ||
|
||
describe '.definition_for' do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,10 @@ module Alchemy | |
end | ||
|
||
describe '.definitions' do | ||
it "should allow erb generated elements" do | ||
expect(Element.definitions.collect {|el| el['name']}).to include('erb_element') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer |
||
end | ||
|
||
context "without existing yml files" do | ||
before { allow(File).to receive(:exists?).and_return(false) } | ||
|
||
|
@@ -42,7 +46,8 @@ module Alchemy | |
end | ||
|
||
context "without any definitions in elements.yml" do | ||
before { allow(YAML).to receive(:load_file).and_return(false) } # Yes, YAML.load_file returns false if an empty file exists. | ||
# Yes, YAML.load returns false if an empty file exists. | ||
before { allow(YAML).to receive(:load).and_return(false) } | ||
|
||
it "should return an empty array" do | ||
expect(Element.definitions).to eq([]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer
map
overcollect
.