Skip to content

Commit

Permalink
Set the filename after renaming the file.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchlloyd committed Feb 10, 2013
1 parent a335d1d commit 11b92f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/podcast_press/audio_file.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
require 'taglib'
require 'ostruct'
require 'forwardable'
require 'podcast_press/tag'
require_relative './tag'

module PodcastPress
class AudioFile
attr_reader :filename
extend Forwardable

def_delegators :@params, :title, :podcast_title, :date
Expand Down Expand Up @@ -36,6 +37,7 @@ def rename!(new_filename)

dir = File.dirname(@filename)
File.rename(@filename, File.join(dir, new_filename))
@filename = new_filename
end

def upload!(s3_bucket)
Expand Down
4 changes: 4 additions & 0 deletions specs/podcast_press_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@
it "renames the file" do
File.exist?("#{SANDBOX}/new_file_name.mp3").must_equal true
end

it "sets the filename to the new file" do
@episode.filename.must_equal 'new_file_name.mp3'
end
end

describe "when #press! is called with an empty hash" do
Expand Down

0 comments on commit 11b92f2

Please sign in to comment.