#2847 Users can now toggle nsfw on and off

This commit is contained in:
Alex Harrison 2012-02-08 23:01:02 +01:00
parent a819f38b99
commit 0cbdf51e6a
2 changed files with 16 additions and 0 deletions

View file

@ -27,6 +27,7 @@ class ProfilesController < ApplicationController
munge_tag_string
@profile_attrs[:searchable] ||= false
@profile_attrs[:nsfw] ||= false
if params[:photo_id]
@profile_attrs[:photo] = Photo.where(:author_id => current_user.person.id, :id => params[:photo_id]).first

View file

@ -42,6 +42,21 @@ describe ProfilesController do
flash[:notice].should_not be_blank
end
it "sets nsfw" do
@user.person(true).profile.nsfw.should == false
put :update, :profile => { :id => @user.person.id, :nsfw => "1" }
@user.person(true).profile.nsfw.should == true
end
it "unsets nsfw" do
@user.person.profile.nsfw = true
@user.person.profile.save
@user.person(true).profile.nsfw.should == true
put :update, :profile => { :id => @user.person.id }
@user.person(true).profile.nsfw.should == false
end
it 'sets tags' do
params = { :id => @user.person.id,
:tags => '#apples #oranges'}