Skip to content

Commit

Permalink
Merge pull request #200 from sue445/feature/miracle_universe
Browse files Browse the repository at this point in the history
Impl `Precure.miracle_universe`
  • Loading branch information
sue445 authored Mar 3, 2019
2 parents 497b9f3 + c917e7d commit acb2818
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,15 @@ and [more aliases!](config/movies.yml)
=> ["キュアミラクル", "キュアマジカル", "キュアフェリーチェ", "キュアホイップ", "キュアカスタード", "キュアジェラート", "キュアマカロン", "キュアショコラ", "キュアパルフェ", "キュアエール", "キュアアンジュ", "キュアエトワール"]
```

### `Precure.miracle_universe`
```ruby
>> Precure.miracle_universe.count
=> 15

>> Precure.miracle_universe.map(&:precure_name)
=> ["キュアホイップ", "キュアカスタード", "キュアジェラート", "キュアマカロン", "キュアショコラ", "キュアパルフェ", "キュアエール", "キュアアンジュ", "キュアエトワール", "キュアマシェリ", "キュアアムール", "キュアスター", "キュアミルキー", "キュアソレイユ", "キュアセレーネ"]
```

### Equivalence
```ruby
>> yayoi = Cure.peace.dup
Expand Down
4 changes: 4 additions & 0 deletions config/movies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,7 @@ ss:
memories: &memories
title: 映画HUGっと!プリキュア♡ふたりはプリキュア オールスターズメモリーズ
started_date: 2018-10-27
#######################################################
miracle_universe: &miracle_universe
title: 映画プリキュアミラクルユニバース
started_date: 2019-03-16
24 changes: 24 additions & 0 deletions lib/rubicure/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,30 @@ def super_stars
end
alias_method :superstars, :super_stars

# rubocop:disable Metrics/LineLength

# Get precure miracle universe
#
# @return [Array<Rubicure::Girl>] precure miracle universe
#
# @example
# Precure.miracle_universe.count
# #=> 15
#
# Precure.miracle_universe.map(&:precure_name)
# #=> ["キュアホイップ", "キュアカスタード", "キュアジェラート", "キュアマカロン", "キュアショコラ", "キュアパルフェ", "キュアエール", "キュアアンジュ", "キュアエトワール", "キュアマシェリ", "キュアアムール", "キュアスター", "キュアミルキー", "キュアソレイユ", "キュアセレーネ"]
def miracle_universe
return @miracle_universe if @miracle_universe

girls = Precure.a_la_mode.girls + Precure.hugtto.girls + Precure.star_twinkle.girls

miracle_universe_date = Rubicure::Movie.find(:miracle_universe).started_date
@miracle_universe = girls.select {|girl| girl.created_date && girl.created_date <= miracle_universe_date }

@miracle_universe
end
# rubocop:enable Metrics/LineLength

# iterate with :unmarked, :max_heart, ...
#
# @yield series
Expand Down
26 changes: 26 additions & 0 deletions spec/rubicure/core_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,30 @@

it { should contain_exactly(*super_stars_girl_names) }
end

describe "#miracle_universe" do
subject { Precure.miracle_universe.map(&:girl_name) }

let(:miracle_universe_girl_names) do
[
Cure.whip,
Cure.custard,
Cure.gelato,
Cure.macaron,
Cure.chocolat,
Cure.parfait,
Cure.yell,
Cure.ange,
Cure.etoile,
Cure.macherie,
Cure.amour,
Cure.star,
Cure.milky,
Cure.soleil,
Cure.selene,
].map(&:girl_name)
end

it { should contain_exactly(*miracle_universe_girl_names) }
end
end
1 change: 1 addition & 0 deletions spec/rubicure/movie_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
:dream_stars,
:super_stars,
:memories,
:miracle_universe,
]
end

Expand Down

0 comments on commit acb2818

Please sign in to comment.