Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions atomic-parsley-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
spec.add_development_dependency "rspec-its"
spec.add_development_dependency "mocha"
end
2 changes: 1 addition & 1 deletion lib/atomic-parsley-ruby/file.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module AtomicParsleyRuby
module File
def self.valid?(fn)
if ![".m4v", ".mp4", ".mp3"].include?(::File.extname(fn))
if ![".m4v", ".mp4", ".mp3", ".m4a"].include?(::File.extname(fn))
raise ::AtomicParsleyRuby::Exception, "Invalid file type."
end
true
Expand Down
2 changes: 1 addition & 1 deletion spec/dependency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module AtomicParsleyRuby
describe Dependency do
it "raises an exception when AtomicParsley in not in your path" do
Dependency.stubs("which").with("AtomicParsley").returns("/usr/bin/AtomicParsley")
Dependency.path.should eq "/usr/bin/AtomicParsley"
expect(Dependency.path).to eq "/usr/bin/AtomicParsley"
end

it "returns the path when AtomicParsley is in your path" do
Expand Down
13 changes: 9 additions & 4 deletions spec/file_spec.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
require "spec_helper"

module AtomicParsleyRuby
describe File do
RSpec.describe File do
it "raises an error when an incorrect file name is passed" do
expect {::AtomicParsleyRuby::File.valid?("test.txt")}.to raise_error(::AtomicParsleyRuby::Exception,"Invalid file type.")
end

it "does not raise an error for mp4s" do
::AtomicParsleyRuby::File.valid?("test.mp4").should be_true
expect(::AtomicParsleyRuby::File.valid?("test.mp4")).to be true
end

its "does not raise an error for m4vs" do
::AtomicParsleyRuby::File.valid?("test.m4v").should be_true
expect(::AtomicParsleyRuby::File.valid?("test.m4v")).to be true
end

its "does not raise an error for mp3s" do
::AtomicParsleyRuby::File.valid?("test.mp3").should be_true
expect(::AtomicParsleyRuby::File.valid?("test.mp3")).to be true
end

it "does not raise an error for m4as" do
expect(::AtomicParsleyRuby::File.valid?("test.m4a")).to be true
end

end
end
4 changes: 2 additions & 2 deletions spec/media_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module AtomicParsleyRuby
::AtomicParsleyRuby::Dependency.stubs(:path).returns("AtomicParsley")
v = Media.new("test.mp4")
v.send(flag, "test-value")
v.cmd.should eq "AtomicParsley test.mp4 --#{flag.to_s} test-value"
expect(v.cmd).to eq "AtomicParsley test.mp4 --#{flag.to_s} test-value"
end
end

Expand Down Expand Up @@ -48,7 +48,7 @@ module AtomicParsleyRuby
config.year "2012"
config.genre "Punk Rock"
end
v.cmd.should eq "AtomicParsley test.mp4 --artist Some\\ Guy --year 2012 --genre Punk\\ Rock test.mp4 --artist Some\\ Guy --year 2012 --genre Punk\\ Rock"
expect(v.cmd).to eq "AtomicParsley test.mp4 --artist Some\\ Guy --year 2012 --genre Punk\\ Rock test.mp4 --artist Some\\ Guy --year 2012 --genre Punk\\ Rock"
end
end
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'rspec'
require 'rspec/its'

require 'atomic-parsley-ruby' # and any other gems you need

Expand Down