igneus / calendarium-romanum

liturgical calendar library (Roman Catholic, post-Vatican II)
50 stars 21 forks source link

Added missing #to_s #42

Closed pjpollina closed 5 years ago

pjpollina commented 5 years ago

As per Issue #30

igneus commented 5 years ago

Thank you very much, looks good. Would you add a basic spec for each added method, checking that it works correctly?

pjpollina commented 5 years ago

Sure thing!

pjpollina commented 5 years ago

Do you have any example instances of the Day and Celebration classes? I'm having a bit of trouble figuring out the proper implementation of their instance variables.

igneus commented 5 years ago

Any call to Calendar#[] or PerpetualCalendar#[] returns a Day instance populated with one or more Celebration. If you want something festive quickly, without bothering about loading sanctorale data, you can take one of the fixed-date celebrations of the temporale cycle, e.g. Dec 25th or Jan 1st:

$ irb -I lib -r calendarium-romanum
> day = CalendariumRomanum::PerpetualCalendar.new[Date.new(2000, 1, 1)]

Now you can explore the Day instance in irb as needed.

pjpollina commented 5 years ago

Thanks! I'll start working right away.

pjpollina commented 5 years ago

There seems to be a discrepancy between the language of certain constants on my machine and Travis CI, the test is working locally but the build fails when I push it. Do you know of any way I can fix that?

igneus commented 5 years ago

Yes. When you execute rspec or rake spec, specs are executed only with the default locale (set to English in spec/spec_helper.rb). Travis runs specs for all supported locales in order to make sure that no functionality is locale-dependent in an unexpected way and that there are all required localization strings for all locales. You can do the same with rake spec_all_locales.

Currently the standard way of handling a locale-specific expectation like this is wrapping it in a block passed to I18n.with_locale - there are numerous examples of this in the test suite.

pjpollina commented 5 years ago

Think I got everything this time.

pjpollina commented 5 years ago

I think that did the trick! I really appreciate all the help and patience you've given me, I've never used many of these tools before so this was a good learning experience to say the least.

igneus commented 5 years ago

You are welcome. RSpec is really widely used in the Ruby community and the i18n gem is Rails' standard way of making applications translatable, so I hope the stuff learned here will be of some further use for you.

Merging.