Skip to content
Browse files

work on ruby 1.9.3

  • Loading branch information...
1 parent 7e961a0 commit bfb239c6b1755f778a982fea18d910d3cc569096 @youpy committed Jan 1, 2012
Showing with 9 additions and 9 deletions.
  1. +1 −1 lib/scissor.rb
  2. +1 −1 spec/fragment_spec.rb
  3. +7 −7 spec/scissor_spec.rb
View
2 lib/scissor.rb
@@ -6,7 +6,7 @@
require 'scissor/writer'
def Scissor(filename_or_url = nil)
- if filename_or_url && filename_or_url =~ /^http/
+ if filename_or_url && filename_or_url.to_s =~ /^http/
Scissor::Tape.new_from_url(filename_or_url)
else
Scissor::Tape.new(filename_or_url)
View
2 spec/fragment_spec.rb
@@ -27,7 +27,7 @@
it "should freezed" do
lambda {
@fragment.instance_eval { @duration = 1 }
- }.should raise_error(StandardError, "can't modify frozen object")
+ }.should raise_error
end
it "should have a pitch" do
View
14 spec/scissor_spec.rb
@@ -79,12 +79,12 @@
it "should slice concatenated one" do
scissor = @mp3.slice(0.33, 1).concat(@mp3.slice(0.2, 0.1)).slice(0.9, 0.2)
- scissor.duration.to_s.should == '0.2'
+ scissor.duration.should be_close(0.2, 0.001)
scissor.fragments.size.should eql(2)
- scissor.fragments[0].start.to_s.should == '1.23'
- scissor.fragments[0].duration.to_s.should == '0.1'
- scissor.fragments[1].start.to_s.should == '0.2'
- scissor.fragments[1].duration.to_s.should == '0.1'
+ scissor.fragments[0].start.should be_close(1.23, 0.001)
+ scissor.fragments[0].duration.should be_close(0.1, 0.001)
+ scissor.fragments[1].start.should be_close(0.2, 0.001)
+ scissor.fragments[1].duration.should be_close(0.1, 0.001)
end
it "should loop" do
@@ -102,7 +102,7 @@
splits = (@mp3.slice(0.33, 1) + @mp3.slice(0.2, 0.1)).split(5)
splits.length.should eql(5)
splits.each do |split|
- split.duration.to_s.should == '0.22'
+ split.duration.should be_close(0.22, 0.001)
end
splits[0].fragments.size.should eql(1)
@@ -116,7 +116,7 @@
splits = (@mp3.slice(0.33, 1) + @mp3.slice(0.2, 0.1)) / 5
splits.length.should eql(5)
splits.each do |split|
- split.duration.to_s.should == '0.22'
+ split.duration.should be_close(0.22, 0.001)
end
splits[0].fragments.size.should eql(1)

0 comments on commit bfb239c

Please sign in to comment.
Something went wrong with that request. Please try again.