diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 2184e7588fec3d4bc7ee0113da0e3a993db18264..57cee918c46997b9000ec0a0cbc017146b6b59eb 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 f4b52657d1c388c7b26d2a958e0ae33ce41d701d..e0f7ce7304f01e2a7c7508759603246dcf92cd94 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'}