Use rails configuration for sounds file path

* Add sounds_path initializer
This commit is contained in:
Thibault Jouan
2011-09-21 21:21:14 +00:00
parent 6af1540640
commit a8067404f4
4 changed files with 8 additions and 3 deletions

View File

@@ -10,8 +10,12 @@ describe Sound do
it { should validate_presence_of :mime_type }
describe '#path' do
it 'starts by the path specified in Rails.configuration.sound_path' do
sound.path.should match(/\A#{Rails.configuration.sounds_path}/)
end
it 'returns the sound file path based on the SHA256 digest' do
sound.path.should == "#{Rails.root}/data/sounds/#{sound.sha256}"
sound.path.should == "#{Rails.configuration.sounds_path}/#{sound.sha256}"
end
end