Sha256: 1f898d852ae70b787c51edd28686d9712fb231c8ed7ce46d0affa9770a44d19e

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 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

6 entries across 6 versions & 1 rubygems

Version Path
troo-0.0.7 test/lib/troo/models/refresh_test.rb
troo-0.0.6 test/lib/troo/models/refresh_test.rb
troo-0.0.5 test/lib/troo/models/refresh_test.rb
troo-0.0.4 test/lib/troo/models/refresh_test.rb
troo-0.0.3 test/lib/troo/models/refresh_test.rb
troo-0.0.2 test/lib/troo/models/refresh_test.rb