Sha256: db4cae4e39d58a177f415f32c372d71ad1cee213e1e408bbefef6054f026a35c

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

require 'rails_helper'

RSpec.describe Cmor::System::Changelog, type: :model do
  it { expect(subject).to respond_to(:id) }
  it { expect(subject).to respond_to(:file) }
  it { expect(subject).to respond_to(:gem) }
  it { expect(subject).to respond_to(:name) }
  it { expect(subject).to respond_to(:version) }

  describe 'self.all' do
    subject { described_class.all }
    it { expect(subject).to be_a(Array) }
  end

  describe 'self.first' do
    subject { described_class.first }
    it { expect(subject).to eq(described_class.all.first) }
  end

  describe 'self.find' do
    context 'with an existing gem' do
      subject { described_class.find('activemodel') }
      it { expect(subject).to be_a(described_class) }
    end

    context 'with a missing gem' do
      subject { described_class.find('missing') }
      it { expect{ subject }.to raise_error(ActiveRecord::RecordNotFound) }
    end
  end

  describe 'self.count' do
    subject { described_class.count }
    it { expect(subject).to eq(described_class.all.size) }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cmor_system-0.0.51.pre spec/models/cmor/system/changelog_spec.rb
cmor_system-0.0.50.pre spec/models/cmor/system/changelog_spec.rb
cmor_system-0.0.49.pre spec/models/cmor/system/changelog_spec.rb
cmor_system-0.0.48.pre spec/models/cmor/system/changelog_spec.rb
cmor_system-0.0.45.pre spec/models/cmor/system/changelog_spec.rb
cmor_system-0.0.44.pre spec/models/cmor/system/changelog_spec.rb