Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

Only support symbol keys for fixure hashes #20

Merged
merged 1 commit into from
Jun 16, 2015

Conversation

dsingleton
Copy link
Contributor

This PR can be merged after 1. otherwise it will break the previewing
of the components using string keys.

Some components templates in static use symbol keys and some use
strings, which is inconsistent and confusing, this helps us
standardise on symbols, by only supporting symbol in guide fixtures.

However the copy/pastable example for a fixture all use symbol keys,
meaning that copy/pasting them into an app would not work if the
component on static used symbols.

Previously the difference was masked with with_indifferent_access,
allowing both types of keys. Only using symbols means any component
trying to access an object by string key will not display the right
data for that key. This should be more obvious to someone checking
the component within the guide.

Longer term we might want to add testing that would also catch this,
but for now we can rely on component changes being tested against
the guide and key problems spotted.

Some components templates in static use symbol keys and some use
strings, which is inconsistent and confusing, this helps us
standardise on symbols, by only supporting sumbol in guide fixtures.

However the copy/pastable example for a fixture all use symbol keys,
meaning that copy/pasting them into an app would not work if the
component on static used symbols.

Previously the difference was masked with `with_indifferent_access`,
allowing both types of keys. Only using symbols means any component
trying to access an object by stirng key will not display the right
data for that key. This should be more obvious to someone checking
the component within the guide.

Longer term we might want to add testing that would also catch this,
but for now we can rely on component changes being tested against
the guide and key problems spotted.
@dsingleton dsingleton changed the title [do-not-merge-yet] Only support symbol keys for fixure hashes Only support symbol keys for fixure hashes Jun 16, 2015
edds added a commit that referenced this pull request Jun 16, 2015
Only support symbol keys for fixure hashes
@edds edds merged commit 174c331 into master Jun 16, 2015
@edds edds deleted the use-symbols-not-strings-for-keys branch June 16, 2015 14:17
dsingleton added a commit to alphagov/static that referenced this pull request Jul 2, 2015
Some components templates in static were using symbol keys and
others strings, which was inconsistent and confusing, by only using
symbols we avoid confusion.

Tools like the component guide have been updated so they will
obviously error when strings are used - previously it silently
corrected any string/key mismatch.

More here: alphagov/govuk-component-guide#20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants