Sha256: 23c83187b4a7433f0aed51bd4e68498a6115c5c2391c4e5776e19442b6ccd701

Contents?: true

Size: 1.15 KB

Versions: 16

Compression:

Stored size: 1.15 KB

Contents

require 'rails_helper'

describe CmsBlog do
  setup_account
  
  it 'write more tests'

  describe 'slug handling' do

    #------------------------------------------------------------------------------
    it 'allows the same blog slug per account (scoped to account)' do
      blog1 = create(:blog)
      Account.current = create(:second_account)
      blog2 = create(:blog)
      expect(blog1.account_id).not_to eq blog2.account_id
      expect(blog1.slug).to eq blog2.slug
    end
    
    #------------------------------------------------------------------------------
    it 'creates a unique auto-generated slug for blogs in the same account' do
      blog1 = create(:blog)
      blog2 = create(:blog, slug: nil)
      expect(blog1.account_id).to eq blog2.account_id
      expect(blog1.slug).not_to eq blog2.slug
    end

    #------------------------------------------------------------------------------
    it 'raises an error when same slug is specified for blogs in the same account' do
      blog1 = create(:blog)
      blog2 = build(:blog)
      expect(blog2).not_to be_valid
      expect(blog2.errors[:slug]).to include("has already been taken")
    end

  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dm_cms-4.2.3.10 spec/models/cms_blog_spec.rb
dm_cms-4.2.3.9 spec/models/cms_blog_spec.rb
dm_cms-4.2.3.8 spec/models/cms_blog_spec.rb
dm_cms-4.2.3.7 spec/models/cms_blog_spec.rb
dm_cms-4.2.3.6 spec/models/cms_blog_spec.rb
dm_cms-4.2.3.5 spec/models/cms_blog_spec.rb
dm_cms-4.2.3.4 spec/models/cms_blog_spec.rb
dm_cms-4.2.3.3 spec/models/cms_blog_spec.rb
dm_cms-4.2.3.2 spec/models/cms_blog_spec.rb
dm_cms-4.2.3.1 spec/models/cms_blog_spec.rb
dm_cms-4.2.3 spec/models/cms_blog_spec.rb
dm_cms-4.2.2.3 spec/models/cms_blog_spec.rb
dm_cms-4.2.2.2 spec/models/cms_blog_spec.rb
dm_cms-4.2.2.1 spec/models/cms_blog_spec.rb
dm_cms-4.2.2 spec/models/cms_blog_spec.rb
dm_cms-4.2.1.5 spec/models/cms_blog_spec.rb