2014-05-15 15:49:06 +00:00
|
|
|
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)
|
2014-09-09 02:23:35 +00:00
|
|
|
notation.size = File.size(NOTATION_TEMP_FILE)
|
2014-05-15 15:49:06 +00:00
|
|
|
notation.user = FactoryGirl.create(:user)
|
|
|
|
|
notation.save!
|
|
|
|
|
|
2014-09-09 02:23:35 +00:00
|
|
|
File.basename(notation.file_url.path).should == notation.user.id
|
2014-05-15 15:49:06 +00:00
|
|
|
notation.size.should == File.size(NOTATION_TEMP_FILE)
|
|
|
|
|
|
|
|
|
|
stub_const("APP_CONFIG", app_config)
|
|
|
|
|
notation.sign_url.should_not be_nil
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|