Sha256: 8b5041b8bdb19a62e1dbf38c66fcb736a8079123b40aed698537d5da220eecd6

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe Museum::Case do
  include_context 'loupe support'
  include_context 'case support'

  it { should validate_presence_of(:name) }
  it { should have_many(:case_details) }

  describe '#freshen_if_expired' do
    subject { expired_package.freshen_if_expired.updated_at.to_datetime }
    it { should be > (Time.now - Museum.configuration.refresh_interval).to_datetime}
  end

  describe '#expired?' do
    context 'on an expired package' do
      subject { expired_package.expired? }
      it { should be true }
    end
    context 'on a fresh package' do
      subject { fresh_package.expired? }
      it { should be false }
    end
  end

  describe '#freshen' do
    subject do
      {
          old_value: dummy_package.updated_at.to_datetime,
          new_value: sleep(10) && dummy_package.freshen.updated_at.to_datetime
      }
    end
    its([:new_value]) { should be > subject[:old_value] }
  end

  describe '#loupe' do
    subject { fresh_package.loupe('rubygems') }
    it { should have_at_least(2).items }
  end

  describe '#to_param' do
    subject { dummy_package.to_param }
    it { should be_a String }
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
museum-0.1.5 spec/models/case_spec.rb
museum-0.1.4 spec/models/case_spec.rb
museum-0.1.3 spec/models/case_spec.rb
museum-0.1.2 spec/models/case_spec.rb
museum-0.1.1 spec/models/case_spec.rb
museum-0.1.0 spec/models/case_spec.rb
museum-0.0.4 spec/models/case_spec.rb
museum-0.0.3 spec/models/case_spec.rb
museum-0.0.2 spec/models/case_spec.rb
museum-0.0.1 spec/models/case_spec.rb