Sha256: 775868dcb157cd451f7fa29516c178c5bb8e16c86d475b2aca68cd4164133b72

Contents?: true

Size: 943 Bytes

Versions: 9

Compression:

Stored size: 943 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe Lcms::Engine::Standard do
  it 'has valid factory' do
    obj = create :standard
    expect(obj).to be_valid
  end

  # rubocop:disable Naming/VariableNumber
  describe '.search_by_name' do
    let(:alt_name) { 'a-synonym' }
    let(:name) { 'test-std' }
    let(:standard_1) { create :standard, alt_names: [alt_name.upcase], grades: ['grade 10'], subject: 'ela' }
    let(:standard_2) { create :standard, alt_names: %w(fake), grades: ['grade 10'], name: name.upcase, subject: 'ela' }

    it { expect(described_class.search_by_name('qwerty').first).to be_nil }

    it 'searches by alt_name' do
      standard_1
      expect(described_class.search_by_name(alt_name).first).to eq standard_1
    end

    it 'searches by name' do
      standard_2
      expect(described_class.search_by_name(name).first).to eq standard_2
    end
  end
  # rubocop:enable Naming/VariableNumber
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lcms-engine-0.5.5 spec/models/standard_spec.rb
lcms-engine-0.5.4 spec/models/standard_spec.rb
lcms-engine-0.5.3 spec/models/standard_spec.rb
lcms-engine-0.5.2 spec/models/standard_spec.rb
lcms-engine-0.5.1 spec/models/standard_spec.rb
lcms-engine-0.5.0 spec/models/standard_spec.rb
lcms-engine-0.4.2 spec/models/standard_spec.rb
lcms-engine-0.4.1 spec/models/standard_spec.rb
lcms-engine-0.4.0 spec/models/standard_spec.rb