Sha256: 07d2ef7b9964e9e86d4026ec2902bcd1178c05d17a2fd51bd65d9783aa1ca81d
Contents?: true
Size: 1.76 KB
Versions: 1
Compression:
Stored size: 1.76 KB
Contents
# frozen_string_literal: true require "rails_helper" module Archangel RSpec.describe Site, type: :model do subject(:resource) { described_class.new } context "with validations" do it { is_expected.to validate_presence_of(:locale) } it { is_expected.to validate_presence_of(:name) } it { is_expected.to allow_value("").for(:theme) } it "allows certain languages" do expect(resource) .to validate_inclusion_of(:locale).in_array(Archangel::LANGUAGES) end it "allows certain themes" do expect(resource) .to validate_inclusion_of(:theme).in_array(Archangel.themes) end end it { is_expected.to have_many(:assets) } it { is_expected.to have_many(:collections) } it { is_expected.to have_many(:designs) } it { is_expected.to have_many(:metatags) } it { is_expected.to have_many(:pages) } it { is_expected.to have_many(:users) } it { is_expected.to have_many(:widgets) } it { is_expected.to have_many(:entries).through(:collections) } it { is_expected.to have_many(:fields).through(:collections) } context "with .current" do it "returns an existing object" do resource = create(:site) expect(described_class.current).to eq(resource) end it "returns an object value" do create(:site, name: "My Awesome New Site") expect(described_class.current.name).to eq("My Awesome New Site") end it "returns a new object" do expect(described_class.current.name).to eq("Archangel") end end context "with #to_liquid" do it "returns a Liquid object" do resource = build(:site) expect(resource.to_liquid).to be_a(Archangel::Liquid::Drops::SiteDrop) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
archangel-0.4.0 | spec/unit/models/archangel/site_spec.rb |