diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 2184e7588..57cee918c 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -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 diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb index f4b52657d..e0f7ce730 100644 --- a/spec/controllers/profiles_controller_spec.rb +++ b/spec/controllers/profiles_controller_spec.rb @@ -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'}