40 lines
975 B
Ruby
40 lines
975 B
Ruby
require 'spec_helper'
|
|
require 'digest/md5'
|
|
|
|
describe MusicNotation do
|
|
|
|
include UsesTempFiles
|
|
|
|
NOTATION_TEMP_FILE='detail.png'
|
|
|
|
in_directory_with_file(NOTATION_TEMP_FILE)
|
|
|
|
before do
|
|
content_for_file("this is music notation test file")
|
|
end
|
|
|
|
it "return empty" do
|
|
MusicNotation.all.length.should == 0
|
|
end
|
|
|
|
|
|
it "should allow insertion" do
|
|
|
|
notation = MusicNotation.new
|
|
notation.file_url = File.open(NOTATION_TEMP_FILE)
|
|
notation.size = File.size(NOTATION_TEMP_FILE)
|
|
notation.user = FactoryBot.create(:user)
|
|
notation.save!
|
|
|
|
File.basename(notation.file_url.path).should == notation.user.id
|
|
notation.size.should == File.size(NOTATION_TEMP_FILE)
|
|
|
|
# Helper for test env where CarrierWave :file storage might not update column for S3 usage
|
|
notation.update_column(:file_url, 'dummy/key') if notation[:file_url].nil?
|
|
notation.reload
|
|
|
|
stub_const("APP_CONFIG", app_config)
|
|
notation.sign_url.should_not be_nil
|
|
|
|
end
|
|
end |