Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[#24] Document classes using yard-spec.

  • Loading branch information...
commit 57512e53b9623897c466f4b82ea7c3ce689c05f3 1 parent 97ee890
@gsmendoza authored
View
4 lib/gitara/node/tab.rb
@@ -11,10 +11,6 @@ class Tab < Base
has_value :title
has_value :transposition
- def self.parse(text)
- Transform.new.apply(Parser.new.parse(text))
- end
-
def max_number_of_voices
definitions(Node::Bar).map{|bar| bar.note_sets.size}.max
end
View
4 spec/lib/gitara/app_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-describe App do
- describe "export" do
+describe Gitara::App do
+ describe "#export" do
it "can convert a tab to lilypond" do
app_test = AppTester.new(:name => 'tab')
app_test.run
View
412 spec/lib/gitara/dsl_spec.rb
@@ -1,306 +1,304 @@
require 'spec_helper'
-describe Gitara do
- describe Dsl do
- describe "bar(name, &block)" do
- it "should add a bar with the name" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+describe Gitara::Dsl do
+ describe "#bar" do
+ it "should add a bar with the name" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- dsl.bar 'Intro'
+ dsl.bar 'Intro'
- dsl.node.children.should have(1).bar
+ dsl.node.children.should have(1).bar
- bar = dsl.node.children[0]
- bar.name.should == 'Intro'
- bar.children.should be_empty
- end
+ bar = dsl.node.children[0]
+ bar.name.should == 'Intro'
+ bar.children.should be_empty
+ end
- it "should add the definition_children declared in the block to the bar" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ it "should add the definition_children declared in the block to the bar" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- note_set = FactoryGirl.build(:note_set)
+ note_set = FactoryGirl.build(:note_set)
- dsl.bar 'Intro' do
- add note_set
- end
+ dsl.bar 'Intro' do
+ add note_set
+ end
- dsl.node.children.should have(1).bar
- dsl.node.children[0].name.should == 'Intro'
+ dsl.node.children.should have(1).bar
+ dsl.node.children[0].name.should == 'Intro'
- bar = dsl.node.children[0]
- bar.children.should have(1).note_set
- bar.children[0].should == note_set
- end
+ bar = dsl.node.children[0]
+ bar.children.should have(1).note_set
+ bar.children[0].should == note_set
end
+ end
- describe "add(child, &block)" do
- it "should add the child to the dsl's node" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ describe "#add" do
+ it "should add the child to the dsl's node" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- bar = FactoryGirl.build(:bar, :name => 'Intro')
+ bar = FactoryGirl.build(:bar, :name => 'Intro')
- dsl.add bar
+ dsl.add bar
- dsl.node.children.should have(1).bar
- dsl.node.children[0].should == bar
- end
+ dsl.node.children.should have(1).bar
+ dsl.node.children[0].should == bar
+ end
- it "should add the definition_children in the block to the child" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ it "should add the definition_children in the block to the child" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- bar = FactoryGirl.build(:bar, :children => [])
- note_set = FactoryGirl.build(:note_set)
+ bar = FactoryGirl.build(:bar, :children => [])
+ note_set = FactoryGirl.build(:note_set)
- dsl.add bar do
- add note_set
- end
+ dsl.add bar do
+ add note_set
+ end
- dsl.node.children.should have(1).bar
- dsl.node.children[0].should == bar
+ dsl.node.children.should have(1).bar
+ dsl.node.children[0].should == bar
- bar.children.should have(1).note_set
- bar.children[0].should == note_set
- end
+ bar.children.should have(1).note_set
+ bar.children[0].should == note_set
end
+ end
- describe "notes(value)" do
- it "should add a note set with the value" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:bar, :children => []))
- dsl.node.children.should be_empty
+ describe "#notes" do
+ it "should add a note set with the value" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:bar, :children => []))
+ dsl.node.children.should be_empty
- dsl.notes 'test'
+ dsl.notes 'test'
- dsl.node.children.should have(1).note_set
- dsl.node.children[0].value.should == 'test'
- end
+ dsl.node.children.should have(1).note_set
+ dsl.node.children[0].value.should == 'test'
end
+ end
- describe "line(name, &block)" do
- it "should add a line with the name" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ describe "#line" do
+ it "should add a line with the name" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- dsl.line 'Intro'
+ dsl.line 'Intro'
- dsl.node.children.should have(1).line
+ dsl.node.children.should have(1).line
- line = dsl.node.children[0]
- line.name.should == 'Intro'
- line.children.should be_empty
- end
+ line = dsl.node.children[0]
+ line.name.should == 'Intro'
+ line.children.should be_empty
+ end
- it "should add the definition_children declared in the block to the line" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ it "should add the definition_children declared in the block to the line" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- bar = FactoryGirl.build(:bar)
+ bar = FactoryGirl.build(:bar)
- dsl.line 'Intro' do
- add bar
- end
+ dsl.line 'Intro' do
+ add bar
+ end
- dsl.node.children.should have(1).line
- dsl.node.children[0].name.should == 'Intro'
+ dsl.node.children.should have(1).line
+ dsl.node.children[0].name.should == 'Intro'
- line = dsl.node.children[0]
- line.children.should have(1).bar
- line.children[0].should == bar
- end
+ line = dsl.node.children[0]
+ line.children.should have(1).bar
+ line.children[0].should == bar
end
+ end
- describe "add_names(o)" do
- it "should add a node with o[:name] of o[:node_class] to the node" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ describe "#add_names" do
+ it "should add a node with o[:name] of o[:node_class] to the node" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- dsl.add_names :names => [:Intro, :Intro], :node_class => Node::Bar
+ dsl.add_names :names => [:Intro, :Intro], :node_class => Node::Bar
- dsl.node.children.should have(2).bars
- dsl.node.children.each do |child|
- child.should be_a(Node::Bar)
- child.name.should == :Intro
- end
+ dsl.node.children.should have(2).bars
+ dsl.node.children.each do |child|
+ child.should be_a(Node::Bar)
+ child.name.should == :Intro
end
+ end
- it "should add a node with nil name if the o[:names] is blank" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ it "should add a node with nil name if the o[:names] is blank" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- dsl.add_names :names => [], :node_class => Node::Bar
+ dsl.add_names :names => [], :node_class => Node::Bar
- dsl.node.children.should have(1).bar
- dsl.node.children[0].attributes[:name].should be_nil
- dsl.node.children[0].should be_a(Node::Bar)
- end
+ dsl.node.children.should have(1).bar
+ dsl.node.children[0].attributes[:name].should be_nil
+ dsl.node.children[0].should be_a(Node::Bar)
end
+ end
- describe "score(name, &block)" do
- it "should add a score with the name" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ describe "#score" do
+ it "should add a score with the name" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- dsl.score
+ dsl.score
- dsl.node.children.should have(1).score
+ dsl.node.children.should have(1).score
- score = dsl.node.children[0]
- score.should be_a(Node::Score)
- score.children.should be_empty
- end
+ score = dsl.node.children[0]
+ score.should be_a(Node::Score)
+ score.children.should be_empty
+ end
- it "should add the definition_children declared in the block to the score" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ it "should add the definition_children declared in the block to the score" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- note_set = FactoryGirl.build(:note_set)
+ note_set = FactoryGirl.build(:note_set)
- dsl.score do
- add note_set
- end
+ dsl.score do
+ add note_set
+ end
- dsl.node.children.should have(1).score
+ dsl.node.children.should have(1).score
- score = dsl.node.children[0]
- score.children.should have(1).note_set
- score.children[0].should == note_set
- end
+ score = dsl.node.children[0]
+ score.children.should have(1).note_set
+ score.children[0].should == note_set
end
+ end
- describe "stanza(name, &block)" do
- it "should add a stanza with the name" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ describe "#stanza" do
+ it "should add a stanza with the name" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- dsl.stanza 'Intro'
+ dsl.stanza 'Intro'
- dsl.node.children.should have(1).stanza
+ dsl.node.children.should have(1).stanza
- stanza = dsl.node.children[0]
- stanza.name.should == 'Intro'
- stanza.children.should be_empty
- end
+ stanza = dsl.node.children[0]
+ stanza.name.should == 'Intro'
+ stanza.children.should be_empty
+ end
- it "should add the definition_children declared in the block to the stanza" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ it "should add the definition_children declared in the block to the stanza" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- line = FactoryGirl.build(:line)
+ line = FactoryGirl.build(:line)
- dsl.stanza 'Intro' do
- add line
- end
+ dsl.stanza 'Intro' do
+ add line
+ end
- dsl.node.children.should have(1).stanza
- dsl.node.children[0].name.should == 'Intro'
+ dsl.node.children.should have(1).stanza
+ dsl.node.children[0].name.should == 'Intro'
- stanza = dsl.node.children[0]
- stanza.children.should have(1).line
- stanza.children[0].should == line
- end
+ stanza = dsl.node.children[0]
+ stanza.children.should have(1).line
+ stanza.children[0].should == line
end
+ end
- [:title, :composer, :arranger, :instrument, :key, :midi_instrument, :string_tunings, :tempo, :transposition].each do |property|
- describe "#{property}(value)" do
- it "should set the #{property} of the tab to value" do
- tab = FactoryGirl.build(:tab)
+ [:title, :composer, :arranger, :instrument, :key, :midi_instrument, :string_tunings, :tempo, :transposition].each do |property|
+ describe "##{property}" do
+ it "should set the #{property} of the tab to value" do
+ tab = FactoryGirl.build(:tab)
- dsl = FactoryGirl.build(:dsl, :node => tab)
- dsl.send property, "test"
+ dsl = FactoryGirl.build(:dsl, :node => tab)
+ dsl.send property, "test"
- tab.send(property).should == "test"
- end
+ tab.send(property).should == "test"
end
end
+ end
- describe "chords(name, value)" do
- it "should add a chord set with the name" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ describe "#chords" do
+ it "should add a chord set with the name" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- dsl.chords :Am, 'r4-"Am" r r r'
+ dsl.chords :Am, 'r4-"Am" r r r'
- dsl.node.children.should have(1).chord_set
+ dsl.node.children.should have(1).chord_set
- chord_set = dsl.node.children[0]
- chord_set.name.should == :Am
- chord_set.value.should == 'r4-"Am" r r r'
- end
+ chord_set = dsl.node.children[0]
+ chord_set.name.should == :Am
+ chord_set.value.should == 'r4-"Am" r r r'
end
+ end
- describe "chords(name)" do
- it "should add a bar with the name" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.node.children.should be_empty
+ describe "#chords" do
+ it "should add a bar with the name" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ dsl.node.children.should be_empty
- dsl.chords :Am
+ dsl.chords :Am
- dsl.node.children.should have(1).chord_set
+ dsl.node.children.should have(1).chord_set
- chord_set = dsl.node.children[0]
- chord_set.name.should == :Am
- end
+ chord_set = dsl.node.children[0]
+ chord_set.name.should == :Am
end
+ end
- describe "partial(duration)" do
- it "should set the specified duration of the bar node to duration" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:bar))
- dsl.node.specified_duration.should be_nil
+ describe "#partial" do
+ it "should set the specified duration of the bar node to duration" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:bar))
+ dsl.node.specified_duration.should be_nil
- dsl.partial 8
+ dsl.partial 8
- dsl.node.specified_duration.should == 8
- end
+ dsl.node.specified_duration.should == 8
end
+ end
- describe "repeat(value)" do
- it "should add a repeat with the value" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ describe "#repeat" do
+ it "should add a repeat with the value" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- dsl.repeat 2
+ dsl.repeat 2
- dsl.node.children.should have(1).repeat
+ dsl.node.children.should have(1).repeat
- repeat = dsl.node.children[0]
- repeat.value.should == 2
- repeat.children.should be_empty
- end
+ repeat = dsl.node.children[0]
+ repeat.value.should == 2
+ repeat.children.should be_empty
+ end
- it "should add the children declared in the block to the repeat" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ it "should add the children declared in the block to the repeat" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- bar = FactoryGirl.build(:bar)
+ bar = FactoryGirl.build(:bar)
- dsl.repeat 2 do
- add bar
- end
+ dsl.repeat 2 do
+ add bar
+ end
- dsl.node.children.should have(1).repeat
+ dsl.node.children.should have(1).repeat
- repeat = dsl.node.children[0]
- repeat.children.should have(1).child
- repeat.children[0].should == bar
- end
+ repeat = dsl.node.children[0]
+ repeat.children.should have(1).child
+ repeat.children[0].should == bar
end
+ end
- describe "alternative(value)" do
- it "should add the children declared in the block to the alternative" do
- dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
- bar = FactoryGirl.build(:bar)
+ describe "#alternative" do
+ it "should add the children declared in the block to the alternative" do
+ dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
+ bar = FactoryGirl.build(:bar)
- dsl.alternative do
- add bar
- end
+ dsl.alternative do
+ add bar
+ end
- dsl.node.children.should have(1).alternative
+ dsl.node.children.should have(1).alternative
- alternative = dsl.node.children[0]
- alternative.children.should have(1).child
- alternative.children[0].should == bar
- end
+ alternative = dsl.node.children[0]
+ alternative.children.should have(1).child
+ alternative.children[0].should == bar
end
end
end
View
4 spec/lib/gitara/node/alternative_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-describe Node::Alternative do
- describe "call_value" do
+describe Gitara::Node::Alternative do
+ describe "#call_value" do
it "should be a call to lilypond's alternative command" do
alternative = FactoryGirl.build(:alternative, :children => [
FactoryGirl.build(:bar, :name => 'First'),
View
4 spec/lib/gitara/node/bar/chorded_version_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-describe 'ChordedVersion' do
- describe "value" do
+describe Gitara::Node::Bar::ChordedVersion do
+ describe "#value" do
it "should be the call names of the chord sets in the bar, if available" do
bar = FactoryGirl.build(:bar, :children => [FactoryGirl.build(:chord_set, :name => :Am, :value => 'r-"Am"')])
View
4 spec/lib/gitara/node/bar/stanza_version_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-describe 'StanzaVersion' do
- describe "value" do
+describe Gitara::Node::Bar::StanzaVersion do
+ describe "#value" do
it "should be the stanza heading of the bar" do
bar = FactoryGirl.build(:bar)
stanza = FactoryGirl.build(:stanza, :name => 'Intro', :children => [bar])
View
4 spec/lib/gitara/node/bar/voiced_version_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-describe 'Bar::VoicedVersion' do
- describe "matching_note_set" do
+describe Gitara::Node::Bar::VoicedVersion do
+ describe "#matching_note_set" do
it "should be the note_set matching this voiced bar" do
note_set = FactoryGirl.build(:note_set)
View
14 spec/lib/gitara/node/bar_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-describe 'Bar' do
- describe "note_sets" do
+describe Gitara::Node::Bar do
+ describe "#note_sets" do
it "should be the note sets of its definition" do
definition_bar = FactoryGirl.build(:bar, :name => 'Intro').tap {|bar|
bar.children = [
@@ -18,7 +18,7 @@
end
end
- describe "stanza_heading" do
+ describe "#stanza_heading" do
it "should be a whole rest with the stanza name if the bar is the first node of a stanza" do
bar = FactoryGirl.build(:bar)
stanza = FactoryGirl.build(:stanza, :name => 'Intro', :children => [bar])
@@ -32,7 +32,7 @@
end
end
- describe "with a special_duration" do
+ describe "#with a special_duration" do
subject { FactoryGirl.build(:bar, :specified_duration => 8) }
it "should be a partial with the stanza name if the bar is the first node of a stanza" do
@@ -46,7 +46,7 @@
end
end
- describe "first_bar_of_stanza?" do
+ describe "#first_bar_of_stanza?" do
it "should be true if the bar is the first bar of a stanza" do
bar = FactoryGirl.build(:bar)
stanza = FactoryGirl.build(:stanza, :name => 'Intro', :children => [bar])
@@ -66,7 +66,7 @@
end
end
- describe "specified_duration_as_lilypond" do
+ describe "#specified_duration_as_lilypond" do
it "should be \\partial specified_duration if present" do
bar = FactoryGirl.build(:bar, :specified_duration => 8)
bar.specified_duration_as_lilypond.should == '\partial 8'
@@ -78,7 +78,7 @@
end
end
- describe "duration" do
+ describe "#duration" do
it "should be 1 if there is no specified duration" do
FactoryGirl.build(:bar, :specified_duration => nil).duration.should == 1
end
View
2  spec/lib/gitara/node/base/chorded_version_spec.rb
@@ -1,5 +1,5 @@
require 'spec_helper'
-describe 'ChordedVersion' do
+describe Gitara::Node::Base::ChordedVersion do
end
View
14 spec/lib/gitara/node/base/node_version_spec.rb
@@ -1,28 +1,28 @@
require 'spec_helper'
-describe Node::Base::NodeVersion do
- describe "prefix" do
+describe Gitara::Node::Base::NodeVersion do
+ describe "#prefix" do
it "should be by default the first letter of the class" do
version = Node::Base::NodeVersion.new
version.prefix.should == 'n'
end
end
- describe "definition_name" do
+ describe "#definition_name" do
it "should include the node's class and the node's name" do
version = Node::Base::NodeVersion.new(:node => FactoryGirl.build(:base, :name => 'some node'))
version.definition_name.should == 'nBaseSomeNode'
end
end
- describe "call_name" do
+ describe "#call_name" do
it "should be the call version of the definition name" do
version = Node::Base::NodeVersion.new(:node => FactoryGirl.build(:base, :name => 'some node'))
version.call_name.should == '\nBaseSomeNode'
end
end
- describe "value" do
+ describe "#value" do
it "should be the call values of its definition_children" do
node = FactoryGirl.build(:base, :children => [
FactoryGirl.build(:base, :name => :First),
@@ -33,7 +33,7 @@
end
end
- describe "definition_children" do
+ describe "#definition_children" do
it "should be versionized versions of the node's definition_children" do
parent = FactoryGirl.build(:base, :name => 'parent')
child = FactoryGirl.build(:base, :name => 'child')
@@ -48,7 +48,7 @@
end
end
- describe "call_value" do
+ describe "#call_value" do
it "should be the call name if we want to render the node's definition name in the lilypond output" do
node = FactoryGirl.build(:base, :name => 'parent')
node_version = Node::Base::NodeVersion.new(:node => node)
View
6 spec/lib/gitara/node/base/voiced_version_spec.rb
@@ -1,14 +1,14 @@
require 'spec_helper'
-describe 'VoicedVersion' do
- describe "prefix" do
+describe Gitara::Node::Base::VoicedVersion do
+ describe "#prefix" do
it "should be based on the voice's id" do
voiced_version = FactoryGirl.build(:voiced_version, :node => FactoryGirl.build(:base, :name => 'Intro'), :voice => FactoryGirl.build(:voice, :id => 1))
voiced_version.prefix.should == 'vOne'
end
end
- describe "definition_children" do
+ describe "#definition_children" do
it "should be voiced versions of the node's definition_children" do
parent = FactoryGirl.build(:base, :name => 'parent')
child = FactoryGirl.build(:base, :name => 'child')
View
36 spec/lib/gitara/node/base_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-describe Node::Base do
- describe "definition_children" do
+describe Gitara::Node::Base do
+ describe "#definition_children" do
it "should be its own children if they exist" do
child = FactoryGirl.build(:base, :id => nil)
@@ -24,7 +24,7 @@
end
end
- describe "children=(other)" do
+ describe "#children=" do
it "should set the ids and parents of the children" do
parent = FactoryGirl.build(:base)
parent.children = [FactoryGirl.build(:base, :id => nil)]
@@ -33,7 +33,7 @@
end
end
- describe "add(child)" do
+ describe "#add" do
it "should set the id and parent of the child" do
parent = FactoryGirl.build(:base)
@@ -63,7 +63,7 @@
end
end
- describe "definition" do
+ describe "#definition" do
it "should be the definition node which matches this node's name" do
definition_bar = FactoryGirl.build(:bar, :name => 'Intro').tap {|bar|
bar.children = [
@@ -80,7 +80,7 @@
end
end
- describe "definition?" do
+ describe "#definition?" do
it "should be true if this node has children" do
definition_bar = FactoryGirl.build(:bar, :name => 'Intro').tap {|bar|
bar.add FactoryGirl.build(:note_set)
@@ -103,7 +103,7 @@
end
end
- describe "value" do
+ describe "#value" do
it "should convert slashes to backslashes" do
node = FactoryGirl.build(:base, :value => %q|notes "<g'/1>8 <a/3>8 <g'/1>8 <a/3>16 <g'/1>8 <g/3>16 <e'/1>4 <g/3>8"|)
node.value.should == %q|notes "<g'\1>8 <a\3>8 <g'\1>8 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>8"|
@@ -115,7 +115,7 @@
end
end
- describe "voiced_as(arg)" do
+ describe "#voiced_as" do
it "should return the voiced version of the node, if arg is a voice" do
node = FactoryGirl.build(:base)
voice = FactoryGirl.build(:voice)
@@ -143,7 +143,7 @@
end
end
- describe "definitions(klass)" do
+ describe "#definitions" do
it "should be itself if it is an instance of the klass" do
node = FactoryGirl.build(:bar)
node.add FactoryGirl.build(:note_set)
@@ -162,7 +162,7 @@
end
end
- describe "name" do
+ describe "#name" do
it "should be the given name, if available" do
FactoryGirl.build(:bar, :name => :Intro).name.should == :Intro
end
@@ -180,28 +180,28 @@
end
end
- describe "id" do
+ describe "#id" do
it "should be 1 by default" do
child = FactoryGirl.build(:note_set)
child.id.should == 1
end
end
- describe "id_as_word" do
+ describe "#id_as_word" do
it "should camelize if necessary" do
node = FactoryGirl.build(:base, :id => 24)
node.id_as_word.should == "TwentyFour"
end
end
- describe "definition_name" do
+ describe "#definition_name" do
it "should turn the name to a lilypond acceptable name" do
node = FactoryGirl.build(:base, :name => "Verse 1 line-2")
node.definition_name.should == "VerseOneLineTwo"
end
end
- describe "descendants(klass)" do
+ describe "#descendants" do
it "should be itself if it is an instance of the klass" do
tab = FactoryGirl.build(:tab, :children => [FactoryGirl.build(:bar)])
tab.descendants(Node::Tab).should == [tab]
@@ -237,7 +237,7 @@
end
end
- describe "chorded" do
+ describe "#chorded" do
it "should return the chorded version of the node" do
node = FactoryGirl.build(:base)
chorded_version = node.chorded
@@ -246,7 +246,7 @@
end
end
- describe "stanza_version" do
+ describe "#stanza_version" do
it "should be a stanza version of the node" do
node = FactoryGirl.build(:base)
stanza_version = node.stanza_version
@@ -255,7 +255,7 @@
end
end
- describe "ancestor(node_class)" do
+ describe "#ancestor" do
it "should be the first ancestor of the node matching the node class" do
bar = FactoryGirl.build(:bar)
line = FactoryGirl.build(:line, :name => 'Intro', :children => [bar])
@@ -270,7 +270,7 @@
end
end
- describe "call_value(node_version)" do
+ describe "#call_value" do
it "should be the call name by default" do
node = FactoryGirl.build(:base, :name => 'MyNode')
node_version = Node::Base::NodeVersion.new(:node => node)
View
4 spec/lib/gitara/node/chord_set/chorded_version_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-describe 'ChordSet::ChordedVersion' do
- describe "value" do
+describe Gitara::Node::ChordSet::ChordedVersion do
+ describe "#value" do
it "should be the chord set's value" do
chorded_version = FactoryGirl.build(:chorded_chord_set, :node => FactoryGirl.build(:chord_set, :name => :Am, :value => '4r-"Am" r r r'))
chorded_version.value.should == '4r-"Am" r r r'
View
2  spec/lib/gitara/node/chord_set_spec.rb
@@ -1,4 +1,4 @@
require 'spec_helper'
-describe Node::ChordSet do
+describe Gitara::Node::ChordSet do
end
View
2  spec/lib/gitara/node/note_set_spec.rb
@@ -1,4 +1,4 @@
require 'spec_helper'
-describe Node::NoteSet do
+describe Gitara::Node::NoteSet do
end
View
4 spec/lib/gitara/node/repeat_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-describe Node::Repeat do
- describe "call_value" do
+describe Gitara::Node::Repeat do
+ describe "#call_value" do
it "should be a call to lilypond's repeat command" do
repeat = FactoryGirl.build(:repeat, :value => 2, :children => [
FactoryGirl.build(:bar)
View
4 spec/lib/gitara/node/stanza_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-describe 'Stanza' do
- describe "heading_in_lilypond" do
+describe Gitara::Node::Stanza do
+ describe "#heading_in_lilypond" do
it "should allow the stanza's name to be added as a heading to the lilypond template" do
stanza = FactoryGirl.build(:stanza, :name => "Verse 1", :children => [
FactoryGirl.build(:line, :children => [
View
12 spec/lib/gitara/node/tab_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
-describe 'Tab' do
- describe "voices" do
- it "should create a <max_number_of_voices> voices" do
+describe Gitara::Node::Tab do
+ describe "#voices" do
+ it "should create a max_number_of_voices voices" do
tab = FactoryGirl.build(:tab, :children => [
FactoryGirl.build(:bar, :children => [
FactoryGirl.build(:note_set),
@@ -17,7 +17,7 @@
end
end
- describe "max_number_of_voices" do
+ describe "#max_number_of_voices" do
it "should be the max number of note_sets in a bar" do
tab = FactoryGirl.build(:tab, :children => [
FactoryGirl.build(:bar, :children => [
@@ -30,7 +30,7 @@
end
end
- describe "playable_child" do
+ describe "#playable_child" do
it "should be the last child of the tab" do
tab = FactoryGirl.build(:tab, :children => [
FactoryGirl.build(:bar, :name => 'Intro', :children => [
@@ -44,7 +44,7 @@
end
end
- describe "midi_instrument" do
+ describe "#midi_instrument" do
it "should have acoustic guitar (nylon) as default" do
tab = FactoryGirl.build(:tab)
tab.midi_instrument.should == 'acoustic guitar (nylon)'
View
18 spec/lib/gitara/voice_spec.rb
@@ -1,37 +1,37 @@
require 'spec_helper'
-describe Voice do
- describe "call_name" do
+describe Gitara::Voice do
+ describe "#call_name" do
it "should be the variable name of the node when called inside lilypond" do
voice = FactoryGirl.build(:voice, :id => 1)
voice.call_name.should == '\vOne'
end
end
- describe "definition_name" do
+ describe "#definition_name" do
it "should be the name of the voice in a lilypond variable definition statement" do
voice = FactoryGirl.build(:voice, :id => 1)
voice.definition_name.should == "vOne"
end
end
- describe "id_as_word" do
+ describe "#id_as_word" do
it "should convert the id to word" do
node = FactoryGirl.build(:voice, :id => 1)
node.id_as_word.should == "One"
end
end
- describe "stem_type" do
+ describe "#stem_type" do
it "should be the lilypond stem type for the voice" do
voice = FactoryGirl.build(:voice, :id => 1)
voice.stem_type.should == '\voiceOne'
end
end
- describe "transposition" do
+ describe "#transposition" do
it "should be based on the tab's transposition and the voice's octave" do
- tab = FactoryGirl.build(:tab,
+ tab = FactoryGirl.build(:tab,
:transposition => 'd',
:children => [
FactoryGirl.build(:bar, :children => [
@@ -50,7 +50,7 @@
end
it "should be blank if the tab has no transposition" do
- tab = FactoryGirl.build(:tab,
+ tab = FactoryGirl.build(:tab,
:children => [
FactoryGirl.build(:bar, :children => [
FactoryGirl.build(:note_set),
@@ -65,7 +65,7 @@
end
end
- describe "octave" do
+ describe "#octave" do
it "should be based on the voice's position in the tab" do
tab = FactoryGirl.build(:tab, :children => [
FactoryGirl.build(:bar, :children => [
Please sign in to comment.
Something went wrong with that request. Please try again.