Skip to content
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

Add MetadataDrop#to_s which outputs pretty JSON representation #78

Merged
merged 3 commits into from
Oct 15, 2016

Conversation

parkr
Copy link
Member

@parkr parkr commented Oct 11, 2016

This fixes an issue where {{ site.github }} doesn't expand out to all the values in the Drop.

This is controlled by Drop#to_s which, by default, is self.class.name.

/cc @jekyll/gh-pages

expect(payload["site"]["github"]).to be_instance_of(described_class)
template = Liquid::Template.parse("{{ site.github }}")
result = template.render!(payload, :registers => { :site => site })
expect(result).to eql(subject.to_s)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't you just testing that Liquid calls to_s on this? Wouldn't this be true if the to_s method wasn't defined? Perhaps match a regex on the content?

Copy link
Member Author

@parkr parkr Oct 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Updated to match the JSON.pretty_generate.

@parkr parkr merged commit de9fa36 into master Oct 15, 2016
parkr added a commit that referenced this pull request Oct 15, 2016
@parkr
Copy link
Member Author

parkr commented Oct 17, 2016

/cc Shopify/liquid#808

@parkr parkr deleted the to_s_for_drop branch October 17, 2016 17:49
@jekyll jekyll locked and limited conversation to collaborators Apr 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants