Skip to content

Commit efb7503

Browse files
authored
refactor: Move Faker::BossaNova under Faker::Music::BossaNova (#3140)
(fixes #3139) Moves +Faker::BossaNova+ generator under +Faker::Music::BossaNova+
1 parent 28505d4 commit efb7503

File tree

7 files changed

+79
-58
lines changed

7 files changed

+79
-58
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
214214
- [Faker::Beer](doc/default/beer.md)
215215
- [Faker::Blood](doc/default/blood.md)
216216
- [Faker::Boolean](doc/default/boolean.md)
217-
- [Faker::BossaNova](doc/default/bossa_nova.md)
218217
- [Faker::Business](doc/default/business.md)
219218
- [Faker::Camera](doc/default/camera.md)
220219
- [Faker::Cannabis](doc/default/cannabis.md)
@@ -420,6 +419,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
420419
- [Faker::Music::Rush](doc/music/rush.md)
421420
- [Faker::Music::SmashingPumpkins](doc/music/smashing_pumpkins.md)
422421
- [Faker::Music::UmphreysMcgee](doc/music/umphreys_mcgee.md)
422+
- [Faker::Music::BossaNova](doc/music/bossa_nova.md)
423423
</details>
424424

425425
<details>

doc/default/bossa_nova.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

doc/music/bossa_nova.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Faker::Music::BossaNova
2+
3+
```ruby
4+
Faker::Music::BossaNova.artist #=> "Tom Jobim"
5+
6+
Faker::Music::BossaNova.song #=> "Chega de Saudade"
7+
```

lib/faker/default/bossa_nova.rb

Lines changed: 0 additions & 33 deletions
This file was deleted.

lib/faker/music/bossa_nova.rb

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# frozen_string_literal: true
2+
3+
require_relative 'music'
4+
5+
module Faker
6+
class Music
7+
class BossaNova < Base
8+
class << self
9+
##
10+
# Produces the name of a bossa nova artist.
11+
#
12+
# @return [String]
13+
#
14+
# @example
15+
# Faker::Music::BossaNova.artist #=> "Tom Jobin"
16+
#
17+
# @faker.version 1.8.3
18+
def artist
19+
fetch('bossa_nova.artists')
20+
end
21+
22+
##
23+
# Produces a bossa nova song.
24+
#
25+
# @return [String]
26+
#
27+
# @example
28+
# Faker::Music::BossaNova.song #=> "Chega de Saudade"
29+
#
30+
# @faker.version 1.8.3
31+
def song
32+
fetch('bossa_nova.songs')
33+
end
34+
end
35+
end
36+
end
37+
38+
include Faker::Deprecator
39+
40+
deprecate_generator('BossaNova', Music::BossaNova)
41+
end

test/faker/default/test_faker_bossa_nova.rb

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# frozen_string_literal: true
2+
3+
require_relative '../../test_helper'
4+
5+
class TestFakerBossaNova < Test::Unit::TestCase
6+
def setup
7+
@tester = Faker::Music::BossaNova
8+
end
9+
10+
def test_artists
11+
assert_match(/\w+/, @tester.artist)
12+
end
13+
14+
def test_songs
15+
assert_match(/\w+/, @tester.song)
16+
end
17+
18+
def test_deprecation
19+
assert_deprecated do
20+
Faker::BossaNova.artist
21+
end
22+
23+
assert_deprecated do
24+
Faker::BossaNova.song
25+
end
26+
27+
assert_match(/\w+/, Faker::BossaNova.artist)
28+
assert_match(/\w+/, Faker::BossaNova.song)
29+
end
30+
end

0 commit comments

Comments
 (0)