socialforge/spec/requests/avatar_request_spec.rb

16 lines
532 B
Ruby

require 'rails_helper'
RSpec.describe "avatar request", type: :request do
describe "上传头像" do
let(:user){FactoryGirl.create(:user)}
it "参数正确,可以成功上传头像" do
data = File.open("#{Rails.root}/spec/fixtures/test.jpg").read
binding.pry
post upload_avatar_path(source_type: 'User', source_id: user.id, filename: 'test.jpg')
expect(response).to have_http_status(:success)
expect(response.body).to include(/\/images\/avatars\/User\//)
end
end
end