Permalink
Browse files

Lots of clean-up to spec directory.

  • Loading branch information...
1 parent 27a8fec commit 59ad2a7f134c08e641fabbce7ce4651eaee2fea6 @rubiety committed Oct 18, 2010
Showing with 182 additions and 494 deletions.
  1. +3 −0 .rspec
  2. +21 −0 spec/chord_collection_spec.rb
  3. +27 −0 spec/chord_quality_spec.rb
  4. +7 −0 spec/chord_scale_spec.rb
  5. +29 −0 spec/chord_spec.rb
  6. +6 −0 spec/chord_symbol_spec.rb
  7. +6 −0 spec/chord_tone_spec.rb
  8. +0 −17 spec/controllers/chord_notes_controller_spec.rb
  9. +0 −17 spec/controllers/chord_qualities_controller_spec.rb
  10. +0 −37 spec/controllers/chord_symbols_controller_spec.rb
  11. +0 −17 spec/controllers/chord_tones_controller_spec.rb
  12. +0 −61 spec/controllers/chords_controller_spec.rb
  13. +0 −4 spec/controllers/jazz_controller_spec.rb
  14. +0 −4 spec/controllers/main_controller_spec.rb
  15. +0 −24 spec/controllers/modes_controller_spec.rb
  16. +0 −12 spec/controllers/notes_collection_controller_spec.rb
  17. +0 −17 spec/controllers/scale_notes_controller_spec.rb
  18. +0 −17 spec/controllers/scale_tones_controller_spec.rb
  19. +0 −17 spec/controllers/scales_controller_spec.rb
  20. +0 −7 spec/controllers/voicing_tones_controller_spec.rb
  21. +0 −7 spec/controllers/voicings_controller_spec.rb
  22. +0 −7 spec/fixtures/keys.yml
  23. +6 −6 spec/{models → }/key_context_spec.rb
  24. +15 −0 spec/key_spec.rb
  25. +3 −3 spec/{models → }/mode_spec.rb
  26. +0 −23 spec/models/chord_collection_spec.rb
  27. +0 −27 spec/models/chord_quality_spec.rb
  28. +0 −7 spec/models/chord_scale_spec.rb
  29. +0 −29 spec/models/chord_spec.rb
  30. +0 −6 spec/models/chord_symbol_spec.rb
  31. +0 −6 spec/models/chord_tone_spec.rb
  32. +0 −15 spec/models/key_spec.rb
  33. +0 −25 spec/models/notes_collection_spec.rb
  34. +0 −6 spec/models/scale_tone_spec.rb
  35. +0 −4 spec/models/tone_spec.rb
  36. +0 −6 spec/models/voicing_spec.rb
  37. +0 −6 spec/models/voicing_tone_spec.rb
  38. +25 −0 spec/notes_collection_spec.rb
  39. +0 −2 spec/rcov.opts
  40. +6 −6 spec/{models → }/scale_spec.rb
  41. +6 −0 spec/scale_tone_spec.rb
  42. +0 −6 spec/spec.opts
  43. +3 −43 spec/spec_helper.rb
  44. +3 −3 spec/{models → }/tone_sequence_spec.rb
  45. +4 −0 spec/tone_spec.rb
  46. +6 −0 spec/voicing_spec.rb
  47. +6 −0 spec/voicing_tone_spec.rb
View
3 .rspec
@@ -0,0 +1,3 @@
+--colour
+--format nested
+--backtrace
@@ -0,0 +1,21 @@
+require "spec_helper"
+
+describe JazzModel::ChordCollection do
+ subject { JazzModel::Scale['Major'].modes[1].chords }
+
+ it "should emit symbols list" do
+ subject.to_s(:symbols).should be_starts_with('maj')
+ end
+
+ it "should emit names list" do
+ subject.to_s(:names).should be_starts_with('Major')
+ end
+
+ it "should resolve chord within" do
+ subject['maj'].should_not be_nil
+ end
+
+ it "should resolve chord within with key context" do
+ subject['Cmaj'].should_not be_nil
+ end
+end
View
@@ -0,0 +1,27 @@
+require "spec_helper"
+
+describe JazzModel::ChordQuality do
+ subject { JazzModel::ChordQuality.new }
+
+ it { should be_valid }
+
+ context "of Major" do
+ subject { ChordQuality.find_by_name('Major') }
+ it { should be_valid }
+ end
+
+ context "of Minor" do
+ subject { ChordQuality.find_by_name('Minor') }
+ it { should be_valid }
+ end
+
+ context "of Dominant" do
+ subject { ChordQuality.find_by_name('Dominant') }
+ it { should be_valid }
+ end
+
+ context "of Diminished" do
+ subject { ChordQuality.find_by_name('Diminished') }
+ it { should be_valid }
+ end
+end
View
@@ -0,0 +1,7 @@
+require "spec_helper"
+
+describe JazzModel::ChordScale do
+ subject { JazzModel::ChordScale.new }
+
+ it { should be_valid }
+end
View
@@ -0,0 +1,29 @@
+require "spec_helper"
+
+describe JazzModel::Chord do
+ subject { JazzModel::Chord.new }
+
+ it { should be_valid }
+
+ pairings = {
+ 'Cmaj' => %w[C E G],
+ 'Cmin' => %w[C Eb G],
+ 'Cmaj7' => %w[C E G B],
+ 'Cmin7' => %w[C Eb G Bb],
+ 'C7' => %w[C E G Bb],
+ 'Cfulldim' => %w[C Eb Gb Bbb]
+ }
+
+ pairings.each do |chord_symbol, notes|
+ context "as #{chord_symbol}" do
+ it "should give valid notes" do
+ chord = JazzModel::Chord[chord_symbol]
+ chord.should_not be_nil
+ chord.notes.should == notes
+ end
+ end
+ end
+end
+
+
+
@@ -0,0 +1,6 @@
+require "spec_helper"
+
+describe JazzModel::ChordSymbol do
+ subject { JazzModel::ChordSymbol.new }
+ it { should be_valid }
+end
View
@@ -0,0 +1,6 @@
+require "spec_helper"
+
+describe JazzModel::ChordTone do
+ subject { JazzModel::ChordTone.new }
+ it { should be_valid }
+end
@@ -1,17 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe ChordNotesController do
- before do
- @request.env["HTTP_ACCEPT"] = "application/xml"
- end
-
- describe "on GET to index" do
- before { get :index, :chord_id => 'Cmaj7' }
- it { should respond_with(:success) }
- end
-
- describe "on GET to show" do
- before { get :index, :chord_id => 'Cmaj7', :id => 1 }
- it { should respond_with(:success) }
- end
-end
@@ -1,17 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe ChordQualitiesController do
- before do
- @request.env["HTTP_ACCEPT"] = "application/xml"
- end
-
- describe "on GET to index" do
- before { get :index }
- it { should respond_with(:success) }
- end
-
- describe "on GET to show" do
- before { get :show, :id => 'Major' }
- it { should respond_with(:success) }
- end
-end
@@ -1,37 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe ChordSymbolsController do
- before do
- @request.env["HTTP_ACCEPT"] = "application/xml"
- end
-
- describe "on GET to index" do
- before { get :index }
- it { should respond_with(:success) }
- end
-
- describe "on GET to show" do
- before { get :show, :id => 'maj7' }
- it { should respond_with(:success) }
- end
-
-
- context "with chord context" do
- describe "on GET to index" do
- before { get :index, :chord_id => 'maj7' }
- it { should respond_with(:success) }
- end
-
- describe "on GET to show" do
- before { get :show, :chord_id => 'maj7', :id => 'maj7' }
- it { should respond_with(:success) }
- end
-
- context "and key context" do
- describe "on GET to show" do
- before { get :show, :chord_id => 'Cmaj7', :id => 'maj7' }
- it { should respond_with(:success) }
- end
- end
- end
-end
@@ -1,17 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe ChordTonesController do
- before do
- @request.env["HTTP_ACCEPT"] = "application/xml"
- end
-
- describe "on GET to index" do
- before { get :index, :chord_id => 'C7' }
- it { should respond_with(:success) }
- end
-
- describe "on GET to show" do
- before { get :show, :chord_id => 'C7', :id => 1}
- it { should respond_with(:success) }
- end
-end
@@ -1,61 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe ChordsController do
- before do
- @request.env["HTTP_ACCEPT"] = "application/xml"
- end
-
- describe "on GET to index" do
- before { get :index }
- it { should respond_with(:success) }
- end
-
- describe "on GET to show" do
- before { get :show, :id => 'C7' }
- it { should respond_with(:success) }
- end
-
- context "with scale context" do
- describe "on GET to index" do
- before { get :index, :scale_id => 'Major' }
- it { should respond_with(:success) }
- end
-
- context "and key context" do
- describe "on GET to index" do
- before { get :index, :scale_id => 'BbMajor' }
- it { should respond_with(:success) }
- end
- end
-
- context "with mode context" do
- describe "on GET to index" do
- before { get :index, :scale_id => 'Major', :mode_id => 'Dorian' }
- it { should respond_with(:success) }
- end
-
- context "and key context" do
- describe "on GET to index" do
- before { get :index, :scale_id => 'BbMajor', :mode_id => 'Dorian' }
- it { should respond_with(:success) }
- end
- end
- end
- end
-
- context "with notes collection context" do
- describe "on GET to index" do
- before { get :index, :notes_collection_id => 'C,E,G,A' }
- it { should respond_with(:success) }
- end
-
- describe "on GET to show" do
- before { get :show, :notes_collection_id => 'C,E,G,A', :id => 'min7' }
- it { should respond_with(:success) }
- end
-
- context "and key context" do
- it "should define specs"
- end
- end
-end
@@ -1,4 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
-
-describe JazzController do
-end
@@ -1,4 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe MainController do
-end
@@ -1,24 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe ModesController do
- before do
- @request.env["HTTP_ACCEPT"] = "application/xml"
- end
-
- describe "on GET to index" do
- before { get :index }
- it { should respond_with(:success) }
- end
-
- context "in scale context" do
- describe "on GET to index" do
- before { get :index, :scale_id => 'Major' }
- it { should respond_with(:success) }
- end
-
- describe "on GET to show" do
- before { get :show, :scale_id => 'Major', :id => 1}
- it { should respond_with(:success) }
- end
- end
-end
@@ -1,12 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe NotesCollectionController do
- before do
- @request.env["HTTP_ACCEPT"] = "application/xml"
- end
-
- describe "on GET to show" do
- before { get :show, :id => 'C,E,G,A' }
- it { should respond_with(:success) }
- end
-end
@@ -1,17 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe ScaleNotesController do
- before do
- @request.env["HTTP_ACCEPT"] = "application/xml"
- end
-
- describe "on GET to index" do
- before { get :index, :scale_id => 'Major' }
- it { should respond_with(:success) }
- end
-
- describe "on GET to show" do
- before { get :show, :scale_id => 'Major', :id => 1 }
- it { should respond_with(:success) }
- end
-end
@@ -1,17 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe ScaleTonesController do
- before do
- @request.env["HTTP_ACCEPT"] = "application/xml"
- end
-
- describe "on GET to index" do
- before { get :index, :scale_id => 'Major' }
- it { should respond_with(:success) }
- end
-
- describe "on GET to show" do
- before { get :show, :scale_id => 'Major', :id => 1 }
- it { should respond_with(:success) }
- end
-end
@@ -1,17 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe ScalesController do
- before do
- @request.env["HTTP_ACCEPT"] = "application/xml"
- end
-
- describe "on GET to index" do
- before { get :index }
- it { should respond_with(:success) }
- end
-
- describe "on GET to show" do
- before { get :show, :id => 'Major' }
- it { should respond_with(:success) }
- end
-end
@@ -1,7 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe VoicingTonesController do
- before do
- @request.env["HTTP_ACCEPT"] = "application/xml"
- end
-end
@@ -1,7 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe VoicingsController do
- before do
- @request.env["HTTP_ACCEPT"] = "application/xml"
- end
-end
View
@@ -1,7 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-
-# one:
-# column: value
-#
-# two:
-# column: value
Oops, something went wrong.

0 comments on commit 59ad2a7

Please sign in to comment.