Sha256: 17efccf5fa6a6014286367399c17ea1c9ca00671b3ce75c716d576fc5b8589de

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

module Logical
  module Naf

    describe ApplicationSchedule do

      describe '#exact_time_of_day' do

        #----------------
        # *** Methods ***
        #++++++++++++++++

        def update_schedule(run_interval)
          schedule.run_interval = run_interval
          schedule.save

          ::Logical::Naf::ApplicationSchedule.new(schedule)
        end

        #------------------------
        # *** Shared Examples ***
        #++++++++++++++++++++++++

        shared_examples 'displays the hour correctly' do |run_interval, time|
          it { update_schedule(run_interval).exact_time_of_day.should == time }
        end

        let!(:schedule) { FactoryGirl.create(:schedule_base) }

        it_should_behave_like 'displays the hour correctly', 10, '12:10 AM'
        it_should_behave_like 'displays the hour correctly', 480, '08:00 AM'
        it_should_behave_like 'displays the hour correctly', 2880, '12:00 AM'
        it_should_behave_like 'displays the hour correctly', 20160, '12:00 AM'
        it_should_behave_like 'displays the hour correctly', 46080, '12:00 AM'

      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
naf-2.1.13 spec/models/logical/naf/application_schedule_spec.rb