Sha256: cdce7521f116e899df553d956933a0955a38b6faedf61b50632b8dd0f0f898a8

Contents?: true

Size: 887 Bytes

Versions: 2

Compression:

Stored size: 887 Bytes

Contents

# frozen_string_literal: true

require "rails_helper"

module Archangel
  RSpec.describe Template, type: :model do
    context "validations" do
      it { is_expected.to validate_presence_of(:content) }
      it { is_expected.to validate_presence_of(:name) }

      it { is_expected.to allow_value(true).for(:partial) }
      it { is_expected.to allow_value(false).for(:partial) }

      it { is_expected.to_not allow_value(nil).for(:partial) }

      it { is_expected.to allow_value("{{ foo }}").for(:content) }
      it { is_expected.to_not allow_value("{{ foo }").for(:content) }
    end

    context "associations" do
      it { is_expected.to belong_to(:site) }

      it "belongs to Template" do
        expect(subject).to(
          belong_to(:parent).conditions(partial: false)
                            .class_name("Archangel::Template")
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
archangel-0.0.7 spec/models/archangel/template_spec.rb
archangel-0.0.6 spec/models/archangel/template_spec.rb