gitara 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,62 +4,62 @@ describe Gitara::Node::Base::NodeVersion do
4
4
  describe "#prefix" do
5
5
  it "should be by default the first letter of the class" do
6
6
  version = Node::Base::NodeVersion.new
7
- version.prefix.should == 'n'
7
+ expect(version.prefix).to eq('n')
8
8
  end
9
9
  end
10
10
 
11
11
  describe "#definition_name" do
12
12
  it "should include the node's class and the node's name" do
13
- version = Node::Base::NodeVersion.new(:node => FactoryGirl.build(:base, :name => 'some node'))
14
- version.definition_name.should == 'nBaseSomeNode'
13
+ version = Node::Base::NodeVersion.new(:node => FactoryBot.build(:base, :name => 'some node'))
14
+ expect(version.definition_name).to eq('nBaseSomeNode')
15
15
  end
16
16
  end
17
17
 
18
18
  describe "#call_name" do
19
19
  it "should be the call version of the definition name" do
20
- version = Node::Base::NodeVersion.new(:node => FactoryGirl.build(:base, :name => 'some node'))
21
- version.call_name.should == '\nBaseSomeNode'
20
+ version = Node::Base::NodeVersion.new(:node => FactoryBot.build(:base, :name => 'some node'))
21
+ expect(version.call_name).to eq('\nBaseSomeNode')
22
22
  end
23
23
  end
24
24
 
25
25
  describe "#value" do
26
26
  it "should be the call values of its definition_children" do
27
- node = FactoryGirl.build(:base, :children => [
28
- FactoryGirl.build(:base, :name => :First),
29
- FactoryGirl.build(:base, :name => :Second)
27
+ node = FactoryBot.build(:base, :children => [
28
+ FactoryBot.build(:base, :name => :First),
29
+ FactoryBot.build(:base, :name => :Second)
30
30
  ])
31
31
  node_version = Node::Base::NodeVersion.new(:node => node)
32
- node_version.value.should == '\nBaseFirst \nBaseSecond'
32
+ expect(node_version.value).to eq('\nBaseFirst \nBaseSecond')
33
33
  end
34
34
  end
35
35
 
36
36
  describe "#definition_children" do
37
37
  it "should be versionized versions of the node's definition_children" do
38
- parent = FactoryGirl.build(:base, :name => 'parent')
39
- child = FactoryGirl.build(:base, :name => 'child')
38
+ parent = FactoryBot.build(:base, :name => 'parent')
39
+ child = FactoryBot.build(:base, :name => 'child')
40
40
  parent.add child
41
41
 
42
42
  node_version = Node::Base::NodeVersion.new(:node => parent)
43
43
 
44
44
  children = node_version.definition_children
45
- children.should have(1).child
46
- children[0].node.should == child
47
- children[0].should be_a(Node::Base::NodeVersion)
45
+ expect(children.size).to eq(1)
46
+ expect(children[0].node).to eq(child)
47
+ expect(children[0]).to be_a(Node::Base::NodeVersion)
48
48
  end
49
49
  end
50
50
 
51
51
  describe "#call_value" do
52
52
  it "should be the call name if we want to render the node's definition name in the lilypond output" do
53
- node = FactoryGirl.build(:base, :name => 'parent')
53
+ node = FactoryBot.build(:base, :name => 'parent')
54
54
  node_version = Node::Base::NodeVersion.new(:node => node)
55
- node_version.call_value.should == '\nBaseParent'
55
+ expect(node_version.call_value).to eq('\nBaseParent')
56
56
  end
57
57
 
58
58
  it "should be the call value of the node if we don't want to render the node's definition name in the lilypond output" do
59
- node = FactoryGirl.build(:base, :name => 'name')
59
+ node = FactoryBot.build(:base, :name => 'name')
60
60
  node_version = Node::Base::NodeVersion.new(:node => node)
61
- node.should_receive(:call_value).with(node_version).and_return("todo { }")
62
- node_version.call_value.should == "todo { }"
61
+ expect(node).to receive(:call_value).with(node_version).and_return("todo { }")
62
+ expect(node_version.call_value).to eq("todo { }")
63
63
  end
64
64
  end
65
65
  end
@@ -3,25 +3,25 @@ require 'spec_helper'
3
3
  describe Gitara::Node::Base::VoicedVersion do
4
4
  describe "#prefix" do
5
5
  it "should be based on the voice's id" do
6
- voiced_version = FactoryGirl.build(:voiced_version, :node => FactoryGirl.build(:base, :name => 'Intro'), :voice => FactoryGirl.build(:voice, :id => 1))
7
- voiced_version.prefix.should == 'vOne'
6
+ voiced_version = FactoryBot.build(:voiced_version, :node => FactoryBot.build(:base, :name => 'Intro'), :voice => FactoryBot.build(:voice, :id => 1))
7
+ expect(voiced_version.prefix).to eq('vOne')
8
8
  end
9
9
  end
10
10
 
11
11
  describe "#definition_children" do
12
12
  it "should be voiced versions of the node's definition_children" do
13
- parent = FactoryGirl.build(:base, :name => 'parent')
14
- child = FactoryGirl.build(:base, :name => 'child')
13
+ parent = FactoryBot.build(:base, :name => 'parent')
14
+ child = FactoryBot.build(:base, :name => 'child')
15
15
  parent.add child
16
16
 
17
- voice = FactoryGirl.build(:voice, :id => 1)
17
+ voice = FactoryBot.build(:voice, :id => 1)
18
18
 
19
- voiced_version = FactoryGirl.build(:voiced_version, :node => parent, :voice => voice)
19
+ voiced_version = FactoryBot.build(:voiced_version, :node => parent, :voice => voice)
20
20
 
21
21
  children = voiced_version.definition_children
22
- children.should have(1).voiced_version
23
- children[0].node.should == child
24
- children[0].voice.should == voice
22
+ expect(children.size).to eq(1)
23
+ expect(children[0].node).to eq(child)
24
+ expect(children[0].voice).to eq(voice)
25
25
  end
26
26
  end
27
27
  end
@@ -3,278 +3,285 @@ require 'spec_helper'
3
3
  describe Gitara::Node::Base do
4
4
  describe "#definition_children" do
5
5
  it "should be its own children if they exist" do
6
- child = FactoryGirl.build(:base, :id => nil)
6
+ child = FactoryBot.build(:base, :id => nil)
7
7
 
8
- parent = FactoryGirl.build(:base)
8
+ parent = FactoryBot.build(:base)
9
9
  parent.children = [child]
10
- parent.definition_children.should == [child]
10
+ expect(parent.definition_children).to eq([child])
11
11
  end
12
12
 
13
13
  it "should be the children of its definition if the node is not a definition" do
14
- child = FactoryGirl.build(:note_set)
15
- definition_bar = FactoryGirl.build(:bar, :name => 'Intro').tap {|bar|
14
+ child = FactoryBot.build(:note_set)
15
+ definition_bar = FactoryBot.build(:bar, :name => 'Intro').tap {|bar|
16
16
  bar.children = [child]
17
17
  }
18
18
 
19
- call_bar = FactoryGirl.build(:bar, :name => 'Intro', :children => [])
19
+ call_bar = FactoryBot.build(:bar, :name => 'Intro', :children => [])
20
20
 
21
- tab = FactoryGirl.build(:tab, :children => [definition_bar, call_bar])
21
+ tab = FactoryBot.build(:tab, :children => [definition_bar, call_bar])
22
22
 
23
- call_bar.definition_children.should == [child]
23
+ expect(call_bar.definition_children).to eq([child])
24
24
  end
25
25
  end
26
26
 
27
27
  describe "#children=" do
28
28
  it "should set the ids and parents of the children" do
29
- parent = FactoryGirl.build(:base)
30
- parent.children = [FactoryGirl.build(:base, :id => nil)]
31
- parent.children[0].id.should == 1
32
- parent.children[0].parent.should == parent
29
+ parent = FactoryBot.build(:base)
30
+ parent.children = [FactoryBot.build(:base, :id => nil)]
31
+ expect(parent.children[0].id).to eq(1)
32
+ expect(parent.children[0].parent).to eq(parent)
33
33
  end
34
34
  end
35
35
 
36
36
  describe "#add" do
37
37
  it "should set the id and parent of the child" do
38
- parent = FactoryGirl.build(:base)
38
+ parent = FactoryBot.build(:base)
39
39
 
40
- parent.add FactoryGirl.build(:base, :id => nil)
41
- parent.children[0].id.should == 1
42
- parent.children[0].parent.should == parent
40
+ parent.add FactoryBot.build(:base, :id => nil)
41
+ expect(parent.children[0].id).to eq(1)
42
+ expect(parent.children[0].parent).to eq(parent)
43
43
 
44
- parent.add FactoryGirl.build(:base, :id => nil)
45
- parent.children[1].id.should == 2
46
- parent.children[1].parent.should == parent
44
+ parent.add FactoryBot.build(:base, :id => nil)
45
+ expect(parent.children[1].id).to eq(2)
46
+ expect(parent.children[1].parent).to eq(parent)
47
47
  end
48
48
 
49
49
  it "should set the id based on existing siblings having the same class as the child" do
50
- parent = FactoryGirl.build(:base)
50
+ parent = FactoryBot.build(:base)
51
51
 
52
- bar_1 = FactoryGirl.build(:bar)
52
+ bar_1 = FactoryBot.build(:bar)
53
53
  parent.add bar_1
54
- bar_1.id.should == 1
54
+ expect(bar_1.id).to eq(1)
55
55
 
56
- line_1 = FactoryGirl.build(:line)
56
+ line_1 = FactoryBot.build(:line)
57
57
  parent.add line_1
58
- line_1.id.should == 1
58
+ expect(line_1.id).to eq(1)
59
59
 
60
- bar_2 = FactoryGirl.build(:bar)
60
+ bar_2 = FactoryBot.build(:bar)
61
61
  parent.add bar_2
62
- bar_2.id.should == 2
62
+ expect(bar_2.id).to eq(2)
63
63
  end
64
64
  end
65
65
 
66
66
  describe "#definition" do
67
67
  it "should be the definition node which matches this node's name" do
68
- definition_bar = FactoryGirl.build(:bar, :name => 'Intro').tap {|bar|
68
+ definition_bar = FactoryBot.build(:bar, :name => 'Intro').tap {|bar|
69
69
  bar.children = [
70
- FactoryGirl.build(:note_set),
71
- FactoryGirl.build(:note_set)
70
+ FactoryBot.build(:note_set),
71
+ FactoryBot.build(:note_set)
72
72
  ]
73
73
  }
74
74
 
75
- call_bar = FactoryGirl.build(:bar, :name => 'Intro', :children => [])
75
+ call_bar = FactoryBot.build(:bar, :name => 'Intro', :children => [])
76
76
 
77
- tab = FactoryGirl.build(:tab, :children => [definition_bar, call_bar])
77
+ tab = FactoryBot.build(:tab, :children => [definition_bar, call_bar])
78
78
 
79
- call_bar.send(:definition).should == definition_bar
79
+ expect(call_bar.send(:definition)).to eq(definition_bar)
80
80
  end
81
81
  end
82
82
 
83
83
  describe "#definition?" do
84
84
  it "should be true if this node has children" do
85
- definition_bar = FactoryGirl.build(:bar, :name => 'Intro').tap {|bar|
86
- bar.add FactoryGirl.build(:note_set)
87
- bar.add FactoryGirl.build(:note_set)
85
+ definition_bar = FactoryBot.build(:bar, :name => 'Intro').tap {|bar|
86
+ bar.add FactoryBot.build(:note_set)
87
+ bar.add FactoryBot.build(:note_set)
88
88
  }
89
- definition_bar.should be_definition
89
+ expect(definition_bar).to be_definition
90
90
  end
91
91
 
92
92
  it "should be true if the node has a value" do
93
- chord_set = FactoryGirl.build(:chord_set, :name => :Am, :value =>'r4-"Am" r r r')
94
- chord_set.children.should be_empty
95
- chord_set.should be_definition
93
+ chord_set = FactoryBot.build(:chord_set, :name => :Am, :value =>'r4-"Am" r r r')
94
+ expect(chord_set.children).to be_empty
95
+ expect(chord_set).to be_definition
96
96
  end
97
97
 
98
98
  it "should be false if this node does not have children and it does not have a value" do
99
- call_bar = FactoryGirl.build(:bar, :name => 'Intro', :children => [])
100
- call_bar.children.should be_empty
101
- call_bar.value.should be_nil
102
- call_bar.should_not be_definition
99
+ call_bar = FactoryBot.build(:bar, :name => 'Intro', :children => [])
100
+ expect(call_bar.children).to be_empty
101
+ expect(call_bar.value).to be_nil
102
+ expect(call_bar).to_not be_definition
103
103
  end
104
104
  end
105
105
 
106
106
  describe "#value" do
107
107
  it "should convert slashes to backslashes" do
108
- 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"|)
109
- 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"|
108
+ node = FactoryBot.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"|)
109
+ expect(node.value).to eq(%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"|)
110
110
  end
111
111
 
112
112
  it "should work with non-strings" do
113
- node = FactoryGirl.build(:base, :value => 1)
114
- node.value.should == 1
113
+ node = FactoryBot.build(:base, :value => 1)
114
+ expect(node.value).to eq(1)
115
115
  end
116
116
  end
117
117
 
118
118
  describe "#voiced_as" do
119
119
  it "should return the voiced version of the node, if arg is a voice" do
120
- node = FactoryGirl.build(:base)
121
- voice = FactoryGirl.build(:voice)
120
+ node = FactoryBot.build(:base)
121
+ voice = FactoryBot.build(:voice)
122
122
 
123
123
  node_voice_pair = node.voiced_as(voice)
124
- node_voice_pair.should be_a(Node::Base::VoicedVersion)
125
- node_voice_pair.node.should == node
126
- node_voice_pair.voice.should == voice
124
+ expect(node_voice_pair).to be_a(Node::Base::VoicedVersion)
125
+ expect(node_voice_pair.node).to eq(node)
126
+ expect(node_voice_pair.voice).to eq(voice)
127
127
  end
128
128
 
129
129
  it "should return the voiced versions of the node, if arg are voices" do
130
- node = FactoryGirl.build(:base)
131
- voices = [FactoryGirl.build(:voice), FactoryGirl.build(:voice)]
130
+ node = FactoryBot.build(:base)
131
+ voices = [FactoryBot.build(:voice), FactoryBot.build(:voice)]
132
132
 
133
133
  node_voice_pairs = node.voiced_as(voices)
134
- node_voice_pairs.size.should == 2
134
+ expect(node_voice_pairs.size).to eq(2)
135
135
 
136
136
  node_voice_pairs.each do |pair|
137
- pair.should be_a(Node::Base::VoicedVersion)
138
- pair.node.should == node
137
+ expect(pair).to be_a(Node::Base::VoicedVersion)
138
+ expect(pair.node).to eq(node)
139
139
  end
140
140
 
141
- node_voice_pairs[0].voice.should == voices[0]
142
- node_voice_pairs[1].voice.should == voices[1]
141
+ expect(node_voice_pairs[0].voice).to eq(voices[0])
142
+ expect(node_voice_pairs[1].voice).to eq(voices[1])
143
143
  end
144
144
  end
145
145
 
146
146
  describe "#definitions" do
147
147
  it "should be itself if it is an instance of the klass" do
148
- node = FactoryGirl.build(:bar)
149
- node.add FactoryGirl.build(:note_set)
150
- node.should be_definition
148
+ node = FactoryBot.build(:bar)
149
+ node.add FactoryBot.build(:note_set)
150
+ expect(node).to be_definition
151
151
 
152
- node.definitions(Node::Bar).should == [node]
152
+ expect(node.definitions(Node::Bar)).to eq([node])
153
153
  end
154
154
 
155
155
  it "should include descendants which are instances of klass" do
156
- node = FactoryGirl.build(:base, :children => [
157
- FactoryGirl.build(:bar, :children => [FactoryGirl.build(:note_set)]),
158
- FactoryGirl.build(:bar, :children => [FactoryGirl.build(:note_set)])
156
+ node = FactoryBot.build(:base, :children => [
157
+ FactoryBot.build(:bar, :children => [FactoryBot.build(:note_set)]),
158
+ FactoryBot.build(:bar, :children => [FactoryBot.build(:note_set)])
159
159
  ])
160
160
 
161
- node.definitions(Node::Bar).should have(2).bars
161
+ expect(node.definitions(Node::Bar).size).to eq(2)
162
162
  end
163
163
  end
164
164
 
165
165
  describe "#name" do
166
166
  it "should be the given name, if available" do
167
- FactoryGirl.build(:bar, :name => :Intro).name.should == :Intro
167
+ expect(FactoryBot.build(:bar, :name => :Intro).name).to eq(:Intro)
168
168
  end
169
169
 
170
170
  it "should be based on the parent's name the node's class and id, if not available" do
171
- child = FactoryGirl.build(:note_set)
172
- bar = FactoryGirl.build(:bar, :name => :Intro, :children => [child])
171
+ child = FactoryBot.build(:note_set)
172
+ bar = FactoryBot.build(:bar, :name => :Intro, :children => [child])
173
173
 
174
- child.name.should == "IntroNoteSetOne"
174
+ expect(child.name).to eq("IntroNoteSetOne")
175
175
  end
176
176
 
177
177
  it "should be based on the node's class and id, if there's no parent and the there's no given name" do
178
- child = FactoryGirl.build(:note_set)
179
- child.name.should == "NoteSetOne"
178
+ child = FactoryBot.build(:note_set)
179
+ expect(child.name).to eq("NoteSetOne")
180
180
  end
181
181
  end
182
182
 
183
183
  describe "#id" do
184
184
  it "should be 1 by default" do
185
- child = FactoryGirl.build(:note_set)
186
- child.id.should == 1
185
+ child = FactoryBot.build(:note_set)
186
+ expect(child.id).to eq(1)
187
187
  end
188
188
  end
189
189
 
190
190
  describe "#id_as_word" do
191
191
  it "should camelize if necessary" do
192
- node = FactoryGirl.build(:base, :id => 24)
193
- node.id_as_word.should == "TwentyFour"
192
+ node = FactoryBot.build(:base, :id => 24)
193
+ expect(node.id_as_word).to eq("TwentyFour")
194
194
  end
195
195
  end
196
196
 
197
197
  describe "#definition_name" do
198
198
  it "should turn the name to a lilypond acceptable name" do
199
- node = FactoryGirl.build(:base, :name => "Verse 1 line-2")
200
- node.definition_name.should == "VerseOneLineTwo"
199
+ node = FactoryBot.build(:base, :name => "Verse 1 line-2")
200
+ expect(node.definition_name).to eq("VerseOneLineTwo")
201
+ end
202
+
203
+ context 'when a word of the name is already camelized' do
204
+ it 'should retain the camelization' do
205
+ node = FactoryBot.build(:base, :name => "Verse 1LineOne")
206
+ expect(node.definition_name).to eq("VerseOneLineOne")
207
+ end
201
208
  end
202
209
  end
203
210
 
204
211
  describe "#descendants" do
205
212
  it "should be itself if it is an instance of the klass" do
206
- tab = FactoryGirl.build(:tab, :children => [FactoryGirl.build(:bar)])
207
- tab.descendants(Node::Tab).should == [tab]
213
+ tab = FactoryBot.build(:tab, :children => [FactoryBot.build(:bar)])
214
+ expect(tab.descendants(Node::Tab)).to eq([tab])
208
215
  end
209
216
 
210
217
  it "should include descendants which are instances of klass" do
211
- tab = FactoryGirl.build(:tab, :children => [
212
- FactoryGirl.build(:bar, :name => :Intro, :children => [
213
- FactoryGirl.build(:note_set)
218
+ tab = FactoryBot.build(:tab, :children => [
219
+ FactoryBot.build(:bar, :name => :Intro, :children => [
220
+ FactoryBot.build(:note_set)
214
221
  ])
215
222
  ])
216
223
 
217
- tab.descendants(Node::Bar).should have(1).bar
224
+ expect(tab.descendants(Node::Bar).size).to eq(1)
218
225
  end
219
226
 
220
227
  it "should follow the definitions of node references for descendants" do
221
- tab = FactoryGirl.build(:tab, :children => [
222
- FactoryGirl.build(:bar, :name => :Intro, :children => [FactoryGirl.build(:note_set)]),
228
+ tab = FactoryBot.build(:tab, :children => [
229
+ FactoryBot.build(:bar, :name => :Intro, :children => [FactoryBot.build(:note_set)]),
223
230
 
224
- FactoryGirl.build(:line, :name => 'Line 1', :children => [
225
- FactoryGirl.build(:bar, :name => :Intro , :children => [])
231
+ FactoryBot.build(:line, :name => 'Line 1', :children => [
232
+ FactoryBot.build(:bar, :name => :Intro , :children => [])
226
233
  ]),
227
234
 
228
- FactoryGirl.build(:stanza, :children => [
229
- FactoryGirl.build(:line, :name => 'Line 1', :children => [])
235
+ FactoryBot.build(:stanza, :children => [
236
+ FactoryBot.build(:line, :name => 'Line 1', :children => [])
230
237
  ])
231
238
  ])
232
239
 
233
240
  bar = tab.children[0]
234
241
 
235
242
  stanza = tab.children[2]
236
- stanza.descendants(Node::Bar).should == [bar]
243
+ expect(stanza.descendants(Node::Bar)).to eq([bar])
237
244
  end
238
245
  end
239
246
 
240
247
  describe "#chorded" do
241
248
  it "should return the chorded version of the node" do
242
- node = FactoryGirl.build(:base)
249
+ node = FactoryBot.build(:base)
243
250
  chorded_version = node.chorded
244
- chorded_version.node.should == node
245
- chorded_version.should be_a(Node::Base::ChordedVersion)
251
+ expect(chorded_version.node).to eq(node)
252
+ expect(chorded_version).to be_a(Node::Base::ChordedVersion)
246
253
  end
247
254
  end
248
255
 
249
256
  describe "#stanza_version" do
250
257
  it "should be a stanza version of the node" do
251
- node = FactoryGirl.build(:base)
258
+ node = FactoryBot.build(:base)
252
259
  stanza_version = node.stanza_version
253
- stanza_version.node.should == node
254
- stanza_version.should be_a(Node::Base::StanzaVersion)
260
+ expect(stanza_version.node).to eq(node)
261
+ expect(stanza_version).to be_a(Node::Base::StanzaVersion)
255
262
  end
256
263
  end
257
264
 
258
265
  describe "#ancestor" do
259
266
  it "should be the first ancestor of the node matching the node class" do
260
- bar = FactoryGirl.build(:bar)
261
- line = FactoryGirl.build(:line, :name => 'Intro', :children => [bar])
262
- stanza = FactoryGirl.build(:stanza, :name => 'Intro', :children => [line])
267
+ bar = FactoryBot.build(:bar)
268
+ line = FactoryBot.build(:line, :name => 'Intro', :children => [bar])
269
+ stanza = FactoryBot.build(:stanza, :name => 'Intro', :children => [line])
263
270
 
264
- bar.ancestor(Node::Stanza).should == stanza
271
+ expect(bar.ancestor(Node::Stanza)).to eq(stanza)
265
272
  end
266
273
 
267
274
  it "should be nil if there is no ancestor matching the node class" do
268
- bar = FactoryGirl.build(:bar)
269
- bar.ancestor(Node::Stanza).should be_nil
275
+ bar = FactoryBot.build(:bar)
276
+ expect(bar.ancestor(Node::Stanza)).to be_nil
270
277
  end
271
278
  end
272
279
 
273
280
  describe "#call_value" do
274
281
  it "should be the call name by default" do
275
- node = FactoryGirl.build(:base, :name => 'MyNode')
282
+ node = FactoryBot.build(:base, :name => 'MyNode')
276
283
  node_version = Node::Base::NodeVersion.new(:node => node)
277
- node.call_value(node_version).should == '\nBaseMyNode'
284
+ expect(node.call_value(node_version)).to eq('\nBaseMyNode')
278
285
  end
279
286
  end
280
287
  end
@@ -3,8 +3,8 @@ require 'spec_helper'
3
3
  describe Gitara::Node::ChordSet::ChordedVersion do
4
4
  describe "#value" do
5
5
  it "should be the chord set's value" do
6
- chorded_version = FactoryGirl.build(:chorded_chord_set, :node => FactoryGirl.build(:chord_set, :name => :Am, :value => '4r-"Am" r r r'))
7
- chorded_version.value.should == '4r-"Am" r r r'
6
+ chorded_version = FactoryBot.build(:chorded_chord_set, :node => FactoryBot.build(:chord_set, :name => :Am, :value => '4r-"Am" r r r'))
7
+ expect(chorded_version.value).to eq('4r-"Am" r r r')
8
8
  end
9
9
  end
10
10
  end
@@ -3,13 +3,13 @@ require 'spec_helper'
3
3
  describe Gitara::Node::Line do
4
4
  describe "#manual_break?" do
5
5
  it "should be true by default" do
6
- described_class.new.manual_break?.should be_true
6
+ expect(described_class.new.manual_break?).to be_truthy
7
7
  end
8
8
 
9
9
  it "should be based on #manual_break field" do
10
10
  line = described_class.new
11
11
  line.manual_break = false
12
- line.manual_break?.should be_false
12
+ expect(line.manual_break?).to be_falsy
13
13
  end
14
14
  end
15
15
  end
@@ -3,12 +3,12 @@ require 'spec_helper'
3
3
  describe Gitara::Node::Repeat do
4
4
  describe "#call_value" do
5
5
  it "should be a call to lilypond's repeat command" do
6
- repeat = FactoryGirl.build(:repeat, :value => 2, :children => [
7
- FactoryGirl.build(:bar)
6
+ repeat = FactoryBot.build(:repeat, :value => 2, :children => [
7
+ FactoryBot.build(:bar)
8
8
  ])
9
9
 
10
10
  version = Node::Base::NodeVersion.new(:node => repeat)
11
- repeat.call_value(version).should == "\\repeat volta 2 { \\nBarRepeatOneBarOne }"
11
+ expect(repeat.call_value(version)).to eq("\\repeat volta 2 { \\nBarRepeatOneBarOne }")
12
12
  end
13
13
  end
14
14
 
@@ -3,34 +3,34 @@ require 'spec_helper'
3
3
  describe Gitara::Node::Stanza do
4
4
  describe "#heading_in_lilypond" do
5
5
  it "should allow the stanza's name to be added as a heading to the lilypond template" do
6
- stanza = FactoryGirl.build(:stanza, :name => "Verse 1", :children => [
7
- FactoryGirl.build(:line, :children => [
8
- FactoryGirl.build(:bar),
9
- FactoryGirl.build(:bar),
6
+ stanza = FactoryBot.build(:stanza, :name => "Verse 1", :children => [
7
+ FactoryBot.build(:line, :children => [
8
+ FactoryBot.build(:bar),
9
+ FactoryBot.build(:bar),
10
10
  ])
11
11
  ])
12
12
 
13
- tab = FactoryGirl.build(:tab, :time => '4/4', :children => [stanza])
13
+ tab = FactoryBot.build(:tab, :time => '4/4', :children => [stanza])
14
14
 
15
- stanza.heading_in_lilypond.should == 'r1^"Verse 1" r1'
15
+ expect(stanza.heading_in_lilypond).to eq('r1^"Verse 1" r1')
16
16
  end
17
17
  end
18
18
 
19
19
  describe "#heading_for_first_bar" do
20
20
  it "should be the time signature's rest bar value with the stanza name if the time signature will generate whole note bars" do
21
- bar = FactoryGirl.build(:bar)
22
- stanza = FactoryGirl.build(:stanza, :name => 'Intro', :children => [bar])
23
- tab = FactoryGirl.build(:tab, :children => [stanza], :time => '4/4')
21
+ bar = FactoryBot.build(:bar)
22
+ stanza = FactoryBot.build(:stanza, :name => 'Intro', :children => [bar])
23
+ tab = FactoryBot.build(:tab, :children => [stanza], :time => '4/4')
24
24
 
25
- stanza.heading_for_first_bar.should == 'r1^"Intro"'
25
+ expect(stanza.heading_for_first_bar).to eq('r1^"Intro"')
26
26
  end
27
27
 
28
28
  it "should attach the stanza name to the first rest note if the time signature will not generate whole note bars" do
29
- bar = FactoryGirl.build(:bar)
30
- stanza = FactoryGirl.build(:stanza, :name => 'Intro', :children => [bar])
31
- tab = FactoryGirl.build(:tab, :children => [stanza], :time => '3/4')
29
+ bar = FactoryBot.build(:bar)
30
+ stanza = FactoryBot.build(:stanza, :name => 'Intro', :children => [bar])
31
+ tab = FactoryBot.build(:tab, :children => [stanza], :time => '3/4')
32
32
 
33
- stanza.heading_for_first_bar.should == 'r4^"Intro" r4 r4'
33
+ expect(stanza.heading_for_first_bar).to eq('r4^"Intro" r4 r4')
34
34
  end
35
35
  end
36
36
  end