Sha256: 11847385b65d04a1bc3fff0df1578b5deb24e8ab7147f07a4c39462fb1e080e3

Contents?: true

Size: 1.96 KB

Versions: 3

Compression:

Stored size: 1.96 KB

Contents

require 'spec_helper'

describe Serinette::Song do
  it 'should have a constant TRACK_NUMBER' do
    expect(Serinette::Song).to have_constant(:TRACK_NUMBER)
  end

  it 'should have a constant EFFECT_NUMBER' do
    expect(Serinette::Song).to have_constant(:EFFECT_NUMBER)
  end

  it 'should have a constant CHANNELS' do
    expect(Serinette::Song).to have_constant(:CHANNELS)
  end

  it 'should have a constant RATE' do
    expect(Serinette::Song).to have_constant(:RATE)
  end

  describe '.default_effects' do
    it 'should exist' do
      expect(Serinette::Song).to respond_to(:default_effects)
    end

    it 'should get output path' do
      default_effects = { rate: Serinette::Song::RATE, channels: Serinette::Song::CHANNELS }
      expect(Serinette::Song.default_effects).to eq default_effects
    end
  end

  context 'given a song' do
    subject(:song) { Serinette::Song.new }

    it 'should have correct number of effects' do
      expect(song.effects.length).to be Serinette::Song::EFFECT_NUMBER
    end

    it 'should have correct number of tracks' do
      expect(song.tracks.length).to be Serinette::Song::TRACK_NUMBER
    end

    it 'should have a variable duration' do
      expect(song.duration).to be_a Fixnum
    end

    it 'should have a duration less than three minutes' do
      expect(song.duration).to be <= 180
    end

    it 'should have a duration more than one minute' do
      expect(song.duration).to be >= 60
    end

    it 'should have tracks' do
      expect(song.tracks).to be_a Array
    end

    it 'should have effects' do
      expect(song.effects).to be_a Array
    end

    it 'should have correct number of tracks' do
      expect(song.tracks.length).to be Serinette::Song::TRACK_NUMBER
      song.tracks.each do |track|
        expect(track).to be_a Serinette::Track
      end
    end

    it 'should call render on all tracks' do
      song.tracks.each do |track|
        expect(track).to receive(:render)
      end

      song.render
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
serinette-0.0.3 spec/serinette/song_spec.rb
serinette-0.0.2 spec/serinette/song_spec.rb
serinette-0.0.0.pre spec/serinette/song_spec.rb