Sha256: 563552aacb97e1cf7c677d0b6bbb16d9d647bd30602bbd9a8afa1ede4c83d6b9

Contents?: true

Size: 958 Bytes

Versions: 4

Compression:

Stored size: 958 Bytes

Contents

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

describe Note do
  before :all do
    @pitch = C4
  end
  
  context '.new' do
    it 'should assign :duration that is given during construction' do
      note = Note.new 2
      note.duration.should eq(2)
    end
    
    it "should assign :accent parameter if given during construction" do
      note = Note.new 2, accent: Accent::Staccato.new
      note.accent.class.should eq(Accent::Staccato)
    end
    
    it 'should have no pitches if not given' do
      Note.new(2).pitches.should be_empty
    end
    
    it 'should assign pitches when given' do
      pitches = [ C2, D2 ]
      n = Note.new(2, pitches)
      n.pitches.should include(pitches[0])
      n.pitches.should include(pitches[1])
    end
  end
  
  context '#duration=' do
    it 'should assign duration' do
      note = Note.new 2, [@pitch]
      note.duration = 3
      note.duration.should eq 3
    end
  end  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
music-transcription-0.5.6 spec/note_spec.rb
music-transcription-0.5.5 spec/note_spec.rb
music-transcription-0.5.3 spec/note_spec.rb
music-transcription-0.5.2 spec/note_spec.rb