Skip to content

Update RSpec matchers to work with custom version association names#925

Merged
jaredbeck merged 1 commit intopaper-trail-gem:masterfrom
kitop:rspec-matchers-custom-association-names
Feb 7, 2017
Merged

Update RSpec matchers to work with custom version association names#925
jaredbeck merged 1 commit intopaper-trail-gem:masterfrom
kitop:rspec-matchers-custom-association-names

Conversation

@kitop
Copy link
Copy Markdown
Contributor

@kitop kitop commented Feb 6, 2017

have_a_version_with and have_a_version_with_changes had the
versions association call hardcoded.
If has_paper_trail had the versions option set to something else
(e.g: has_paper_trail versions: :paper_trail_versions) the matcher
couldn't be used.

This fixes that issue by dynamically fetching the association name from
the :versions_association_name class attribute.

@jaredbeck
Copy link
Copy Markdown
Member

Thanks, Esteban! Looks good. Please add a test in spec/models/document_spec.rb, and add an entry to the changelog.

@kitop
Copy link
Copy Markdown
Contributor Author

kitop commented Feb 7, 2017

Sure. On it!

@kitop kitop changed the title Update rspec matcher to work with custom version association names Update RSpec matchers to work with custom version association names Feb 7, 2017
@kitop kitop force-pushed the rspec-matchers-custom-association-names branch from 97681fc to 1677508 Compare February 7, 2017 09:25
`have_a_version_with` and `have_a_version_with_changes` had the
`versions` association call hardcoded.
If `has_paper_trail` had the `versions` option set to something else
(e.g: `has_paper_trail versions: :paper_trail_versions`) the matcher
couldn't be used.

This fixes that issue by dynamically fetching the association name from
the `:versions_association_name` class attribute.
@kitop kitop force-pushed the rspec-matchers-custom-association-names branch from 1677508 to 60847d6 Compare February 7, 2017 09:26
@kitop
Copy link
Copy Markdown
Contributor Author

kitop commented Feb 7, 2017

Done, and squashed.

@jaredbeck jaredbeck merged commit 81db706 into paper-trail-gem:master Feb 7, 2017
@jaredbeck
Copy link
Copy Markdown
Member

Nice work, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants