move profile_background from User to UserProfile

This commit is contained in:
Andrew Bezzub
2014-06-26 12:30:07 -04:00
committed by Robin Ward
parent 00910679ad
commit 386d1e231a
8 changed files with 53 additions and 18 deletions
+3 -3
View File
@@ -1169,7 +1169,7 @@ describe UsersController do
xhr :post, :upload_user_image, username: user.username, file: user_image, user_image_type: "profile_background"
user.reload
user.profile_background.should == "/uploads/default/1/1234567890123456.png"
user.user_profile.profile_background.should == "/uploads/default/1/1234567890123456.png"
# returns the url, width and height of the uploaded image
json = JSON.parse(response.body)
@@ -1218,7 +1218,7 @@ describe UsersController do
Upload.expects(:create_for).returns(upload)
xhr :post, :upload_user_image, username: user.username, file: user_image_url, user_image_type: "profile_background"
user.reload
user.profile_background.should == "/uploads/default/1/1234567890123456.png"
user.user_profile.profile_background.should == "/uploads/default/1/1234567890123456.png"
# returns the url, width and height of the uploaded image
json = JSON.parse(response.body)
@@ -1287,7 +1287,7 @@ describe UsersController do
it 'it successful' do
xhr :put, :clear_profile_background, username: user.username
user.reload.profile_background.should == ""
user.reload.user_profile.profile_background.should == ""
response.should be_success
end
+10
View File
@@ -32,6 +32,16 @@ describe UserSerializer do
end
end
context "with filled out profile background" do
before do
user.user_profile.profile_background = 'http://background.com'
end
it "has a profile background" do
expect(json[:profile_background]).to eq 'http://background.com'
end
end
context "with filled out website" do
before do
user.user_profile.website = 'http://example.com'