On Wed, Dec 31, 2008 at 8:00 AM, Nasir Jamal <nas35...@yahoo.com> wrote:
> Hi,
>
> I am a rspec newbie, can anyone guide me on how to write a spec for the
> below helper.
>
> module MyHelper
>  def test
>    link_to('MyLink', resources_path) if @categories || @sub_categories
>  end
> end
>
> @categories is an instance of Category model
> @sub_categories is an instance of SubCategory model

Take a look at http://rspec.info/documentation/rails/writing/helpers.html.
You can use assigns[:categories] and assigns[:sub_categories] to make
the necessary data available to the helper.

HTH,
David

>
>
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to