Sha256: 00ecbd5e2cca6184a50d4b134890f3a63fee220e031fe7f079194c9157c035f9

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

require 'rails_helper'

module Museum
  RSpec.describe CaseDetail do
    include_context 'loupe support'
    include_context 'case support'

    describe 'Model' do
      it { should validate_presence_of(:key) }
      it { should validate_presence_of(:case) }
      it { should validate_presence_of(:loupe) }
      it { should belong_to(:case) }
      it { should belong_to(:loupe) }
    end

    describe '#update_or_create_by' do
      subject {
        args = { loupe: rubygems, case: dummy_package, key: 'name'}
        attributes = { value: 'test' }
        Museum::CaseDetail.update_or_create_by(args, attributes)
        Museum::CaseDetail.find_by(args)
      }
      its([:value]) { should == 'test' }
    end

    describe '#find_all_by_loupe_slug' do
      subject { Museum::CaseDetail.find_all_by_loupe_slug('rubygems').count }
      it { should be >= 2 }
    end

    describe '#detail' do
      subject { fresh_package.loupe('rubygems').detail('name') }
      it { should == "bootstrap_pager" }
    end

    describe '#follow' do
      subject { fresh_package.loupe('rubygems').follow('homepage_uri') }
      it { should be_a String }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
museum-0.5.8 spec/models/case_detail_spec.rb
museum-0.5.7 spec/models/case_detail_spec.rb
museum-0.5.6 spec/models/case_detail_spec.rb
museum-0.5.4 spec/models/case_detail_spec.rb
museum-0.5.3 spec/models/case_detail_spec.rb
museum-0.5.2 spec/models/case_detail_spec.rb
museum-0.5.1 spec/models/case_detail_spec.rb
museum-0.5.0 spec/models/case_detail_spec.rb