require 'spec_helper'
require 'digest/md5'

# NOTE this was cloned from music_notation_spec.rb

describe MobileRecordingUpload do

  include UsesTempFiles

  MRU_TEMP_FILE='detail.mp3'

  in_directory_with_file(MRU_TEMP_FILE)

  before do
    content_for_file("this is mobile recording test file")
  end

  it "return empty" do
    MobileRecordingUpload.all.length.should == 0
  end


  it "should allow insertion" do
    mru = MobileRecordingUpload.new
    mru.file_url = File.open(MRU_TEMP_FILE)
    mru.size = File.size(MRU_TEMP_FILE)

    mr = MobileRecording.new
    mr.user = FactoryGirl.create(:user)
    mr.save!
    
    mru.mobile_recording = mr
    mru.save!

    File.basename(mru.file_url.path).should == mr.user_id
    mru.size.should == File.size(MRU_TEMP_FILE)

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

  end
end
