Sha256: 7313ec173be80a57eea886d7d70d29efe0e0385362932ece4e3901928baffab8
Contents?: true
Size: 833 Bytes
Versions: 4
Compression:
Stored size: 833 Bytes
Contents
require 'rails_helper' RSpec.describe Categorical::Tag, type: :model do it_behaves_like "a sluggable" do subject { FactoryBot.build(:tag, label: '', slug: 'a-slug') } end describe "#slug" do it "is created automatically from the label if not provided" do tag = create(:tag, label: "My Tag") expect(tag.slug).to eq('my-tag') end it "is created by user input if provided" do tag = create(:tag, label: "My Tag", slug: "my slug") expect(tag.slug).to eq('my-slug') end end describe "#to_param" do it "returns the slug" do tag = build(:tag, slug: 'my-slug') expect(tag.to_param).to eq('my-slug') end end describe "#to_s" do it "returns the label" do tag = build(:tag, label: 'coffee') expect(tag.to_s).to eq('coffee') end end end
Version data entries
4 entries across 4 versions & 2 rubygems