-
Notifications
You must be signed in to change notification settings - Fork 115
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
Rspec testing #28
Comments
I have the same problem! How can I test it? |
Almost 2 years after, in case anyone still needs help with this, here is a code snippet for RSpec describe '#full_name' do
it 'returns the full organization name' do
organization = create(:organization, first_name: 'John', last_name: 'Doe')
decorated_organization = ActiveDecorator::Decorator.instance.decorate(organization)
expect(decorated_organization.full_name).to eq('John Doe')
end
end With the simple decorator module OrganizationDecorator
def full_name
"#{first_name} #{last_name}"
end
end |
Would be nice add some rspec examples like above in readme.md or wiki @amatsuda. |
@glaucocustodio Thanks for the suggestion. I'm not sure whether people are still using rspec , but yes, any kind of documentation PRs are absolutely welcomed! |
Thank you all! |
I still receive that problem by trying to test with MiniTest... decorated = ActiveDecorator::Decorator.instance.decorate(account) I receive: (byebug) decorated.children(',') nil |
It would be nice to add how to test for minitest. The default class created by ActiveDecorator doesn't work. |
I realize this issue is closed but thought I would add my comment here. I started using this gem and let it generate a Decorator and corresponding RSpec spec. My first test immediately failed because the
|
If automatically mixes decorator module into corresponding model only when:
How could I to test my decorator's methods with RSpec? Check it out https://gist.github.com/glaucocustodio/81e2d036c67b893c1e6a
Thank you.
The text was updated successfully, but these errors were encountered: