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

Fast specs #430

Merged
merged 5 commits into from Jan 20, 2013
Merged

Fast specs #430

merged 5 commits into from Jan 20, 2013

Conversation

haines
Copy link
Contributor

@haines haines commented Jan 19, 2013

a039671 adds a Draper::ViewContext.test_strategy method. The default setting is test_strategy :full, which retains the current behaviour (create an ApplicationController and use its view context in the tests).

Using test_strategy :fast eliminates this dependency and instead uses a subclass of ActionView::Base, allowing decorators to be tested in isolation as discussed in #424.

If some of the application's helpers are required, they can be selectively included by passing a block:

Draper::ViewContext.test_strategy :fast do
  include ApplicationHelper
end

I also fixed a minor bug (3d07cb3) which potentially introduces order dependencies into tests. The view context was being set in controller and mailer specs but not cleared afterwards; decorator specs executed subsequently were using that view context rather than building one.

steveklabnik added a commit that referenced this pull request Jan 20, 2013
@steveklabnik steveklabnik merged commit 4d0181f into drapergem:master Jan 20, 2013
@steveklabnik
Copy link
Member

Awesome. :)

@haines haines mentioned this pull request Jan 20, 2013
@haines haines deleted the fast_specs branch January 21, 2013 21:28
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.

None yet

2 participants