Sha256: f10139a9f1b5f55bee094a3a08689f6cc2de44b8d6bb52bcb46717dbd31d20c8

Contents?: true

Size: 1.16 KB

Versions: 8

Compression:

Stored size: 1.16 KB

Contents

require_relative '../../../test_helper'

module Troo
  describe Refresh do
    let(:described_class) { Refresh }
    let(:described_instance) { Fabricate.build(:refresh) }

    subject { described_instance }

    context 'attributes' do
      it 'should have a last_performed_at attribute' do
        subject.last_performed_at
          .must_equal(Time.parse('2014-01-16 21:00:00 UTC'))
      end
    end

    context 'actions' do
      before { @refresh = Fabricate(:refresh) }
      after  { database_cleanup }

      describe '.completed!' do
        subject { described_class.completed! }

        it 'updates the last performed at timestamp' do
          subject.wont_equal @refresh.last_performed_at
        end
      end

      describe '.last_performed_at?' do
        subject { described_class.last_performed_at? }

        context 'when one has not been performed' do
          before { @refresh.delete }

          it { subject.must_equal(nil) }
        end

        context 'when one has been performed' do
          it 'returns the last performed timestamp' do
            subject.must_equal @refresh.last_performed_at
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
troo-0.0.15 test/lib/troo/models/refresh_test.rb
troo-0.0.14 test/lib/troo/models/refresh_test.rb
troo-0.0.13 test/lib/troo/models/refresh_test.rb
troo-0.0.12 test/lib/troo/models/refresh_test.rb
troo-0.0.11 test/lib/troo/models/refresh_test.rb
troo-0.0.10 test/lib/troo/models/refresh_test.rb
troo-0.0.9 test/lib/troo/models/refresh_test.rb
troo-0.0.8 test/lib/troo/models/refresh_test.rb