Harry Bishop wrote:
> David Chelimsky wrote:
>> On Mon, Oct 20, 2008 at 6:53 AM, Harry Bishop <[EMAIL PROTECTED]> 
>> wrote:
>>>>> called from the database to test the true interaction between user and
>>>>> motion.
>>>>
>>>> Not necessarily.  Have you looked into using a null_object mock?
>>>>
>>>> Scott
>>>
>>> Yes, I tried null object but it doesn't get past is_showable? which says
>>> it has a nil object passed in.
>>> The idea is to use @current_user to determine if @motion is shown on the
>>> view.  So how come @current_user isn't available in the controller?
>> 
>> Can you please post the controller code?
> 
> Hi,
 The controller show action is:

  def show
     @motion = Motion.find(params[:id])
     if is_showable?(@current_user, @motion)
       (@vote = 
@motion.votes.find_by_shortname(@current_user.shortname))
 if is_votable?(@current_user, @motion)

       respond_to do |format|
         format.html # show.html.erb
         format.xml  { render :xml => @motion }
         end
     else
     flash[:error] = "You are not in that group."
     redirect_to motions_path
     end
   end

 HR

and is_showable? here:

  def is_showable?(user, motion)
    user.group_member?( motion.group_name )
  end
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to