Merge pull request #2848 from beardedninja/master

#2847 Users can now toggle nsfw on and off
This commit is contained in:
Maxwell Salzberg 2012-02-08 17:21:29 -08:00
commit 062204e963
2 changed files with 16 additions and 0 deletions

View file

@ -29,6 +29,7 @@ class ProfilesController < ApplicationController
#checkbox tags wtf
@profile_attrs[:nsfw] ||= false
@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'}