Sha256: 2adae0705315eb343a36f9b4231bb73270ea5a54fd64915eaccb6204b541d2f6

Contents?: true

Size: 1.77 KB

Versions: 8

Compression:

Stored size: 1.77 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Change::Immediate do
  context '.new' do
    it 'should set value to given' do
      Change::Immediate.new(5).value.should eq 5
    end
    
    it 'should set duration to 0' do
      Change::Immediate.new(5).duration.should eq 0
    end
  end
    
  describe '==' do
    it 'should return true if two immediate changes have the same value' do
      Change::Immediate.new(5).should eq(Change::Immediate.new(5))
    end
    
    it 'should return false if two immediate changes do not have the same value' do
      Change::Immediate.new(5).should_not eq(Change::Immediate.new(4))
    end
  end
  
  describe '#to_yaml' do
    it 'should produce YAML that can be loaded' do
      c = Change::Immediate.new(4)
      YAML.load(c.to_yaml).should eq c
    end
  end
end

describe Change::Gradual do
  context '.new' do
    it 'should set value to given value' do
      Change::Gradual.new(5,2).value.should eq 5
    end
    
    it 'should set duration to given duration' do
      Change::Gradual.new(5,2).duration.should eq 2
    end
  end
    
  describe '==' do
    it 'should return true if two gradual changes have the same value and duration' do
      Change::Gradual.new(5,2).should eq(Change::Gradual.new(5,2))
    end
    
    it 'should return false if two gradual changes do not have the same value' do
      Change::Gradual.new(5,2).should_not eq(Change::Gradual.new(4,2))
    end
    
    it 'should return false if two gradual changes do not have the same duration' do
      Change::Gradual.new(5,2).should_not eq(Change::Gradual.new(5,1))
    end
  end
  
  describe '#to_yaml' do
    it 'should produce YAML that can be loaded' do
      c = Change::Gradual.new(4,2)
      YAML.load(c.to_yaml).should eq c
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
music-transcription-0.19.0 spec/model/change_spec.rb
music-transcription-0.17.1 spec/model/change_spec.rb
music-transcription-0.17.0 spec/model/change_spec.rb
music-transcription-0.16.0 spec/model/change_spec.rb
music-transcription-0.15.0 spec/model/change_spec.rb
music-transcription-0.14.0 spec/model/change_spec.rb
music-transcription-0.13.0 spec/model/change_spec.rb
music-transcription-0.11.0 spec/model/change_spec.rb