Sha256: 055450de24275ea0e174aa9726b4bf2683e7433746c063316a2c4e5c8c438951
Contents?: true
Size: 870 Bytes
Versions: 3
Compression:
Stored size: 870 Bytes
Contents
require 'rails_helper' RSpec.describe TbCommerce::Category, type: :model do describe '#generate_slug_from_title' do it 'should generate a url slug for the category' do category = FactoryGirl.create(:tb_commerce_category) expect(category.slug).to be_a(String) end it 'should also change the slug if the title changes' do category = FactoryGirl.create(:tb_commerce_category) expect{ category.update_attribute(:title, 'New Category Title') }.to change(category, :slug) end end describe '#destroy' do it 'should null out foreign keys' do category = FactoryGirl.create(:tb_commerce_category) product = FactoryGirl.create(:tb_commerce_product, :category => category) expect{ category.destroy() product.reload }.to change(product, :category).to(nil) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tb_commerce-0.0.4 | spec/models/tb_commerce/category_spec.rb |
tb_commerce-0.0.3 | spec/models/tb_commerce/category_spec.rb |
tb_commerce-0.0.2 | spec/models/tb_commerce/category_spec.rb |