Skip to content

Exception with default_starts_date #35

@danielveloso09

Description

@danielveloso09

Hi,

Thanks for the work on this gem, it has been quite useful in different projects through the years 😅

While doing some tests found a small issue doing Recurrence.default_starts_date, which raises an exception. But if you do Recurrence_.default_starts_date everything works fine. We can also just force the starts option, and everything is fine.

Notice that you've changed default_stars_date class method a couple months ago, which raised this issue when using Recurrence or any class that extends from Recurrence_

Is there any specific reason to have the method like:

def self.default_starts_date
  @default_starts_date.call
end

Instead of directly use the constant:

def self.default_starts_date
  DEFAULT_STARTS_DATE.call
end

If you don't see any issue with the above suggestion, I would be glad to open the PR to fix it.


Edit:

While running the test got the intention for it 👍

So could it be something like this?

def self.default_starts_date
  @default_starts_date ||= DEFAULT_STARTS_DATE
  @default_starts_date.call
end

Also, this didn't appear on the tests cause in the test_helper.rb#setup is setting it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions