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 = FactoryGirl.create(:user)
    notation.save!

    File.basename(notation.file_url.path).should == notation.user.id
    notation.size.should == File.size(NOTATION_TEMP_FILE)

    stub_const("APP_CONFIG", app_config)
    notation.sign_url.should_not be_nil

  end
end