Sha256: 2134c75724697821376b86c76ef8423d14c298bd38749cca258c9604b5dd2837

Contents?: true

Size: 629 Bytes

Versions: 4

Compression:

Stored size: 629 Bytes

Contents

module SpecHelpers
  module ParserMacros
    extend ActiveSupport::Concern

    module ClassMethods
      def its_occurrences_until(date, &block)
        describe "occurrences" do
          shared_examples 'occurrences' do

            orig_subject = subject

            self.class.class_eval do
              define_method(:subject) do
                schedule = IceCube::Schedule.new(Date.today.to_time)
                schedule.add_recurrence_rule(orig_subject)
                @_subject = schedule.occurrences(date)
              end
            end

            yield
          end
        end
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dgp-schedule_attributes-0.5.3 spec/support/parser_macros.rb
dgp-schedule_attributes-0.5.2 spec/support/parser_macros.rb
dgp-schedule_attributes-0.5.1 spec/support/parser_macros.rb
dgp-schedule_attributes-0.5.0 spec/support/parser_macros.rb