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) { Profil
> > Is the best way to get a real-world view context in there to do something
> > like:
> >
> > Blah.new(ActionView::Base.new) ?
> >
> > Or does RSpec have something magical already setup for this sort of thing?
>
> Nope. rspec-rails doesn't know that you want to write presenters :)
>
> I'd sa
On Nov 2, 2011, at 9:46 PM, Patrick J. Collins wrote:
> I have a presenter class which is instantiated like this:
>
> class Blah
>
> def initialize(context)
>@context = context
> end
>
> def do_something_view_related
>@context.render :partial => "/...somewhere"
> end
>
> def do_so
On Nov 2, 2011, at 9:52 PM, David Chelimsky wrote:
> On Nov 2, 2011, at 9:46 PM, Patrick J. Collins wrote:
>
>> I have a presenter class which is instantiated like this:
>>
>> class Blah
>>
>> def initialize(context)
>> @context = context
>> end
>>
>> def do_something_view_related
>> @cont
I have a presenter class which is instantiated like this:
class Blah
def initialize(context)
@context = context
end
def do_something_view_related
@context.render :partial => "/...somewhere"
end
def do_something_else_view_related
@context.content_tag :p, "fancy paragraph"