[rspec-users] view_context in specs

Benito S. lists at ruby-forum.com
Mon Jan 9 18:37:47 EST 2012

If you put this on your spec_helper.rb

//If you have your spec in the directory "spec/presenters"
config.include ActionView::TestCase::Behavior, example_group:
{file_path: %r{spec/presenters}}

Then you can use a method, :view, that you can use as the view context
like this

let(:profile) { ProfilePresenter.new(@user, view) }

....... There is a Railscast about it.

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list