Sha256: 84051202b3e293389581e4ebdebcbb847db82375a9001e04d03dfb94304bf44a
Contents?: true
Size: 758 Bytes
Versions: 1
Compression:
Stored size: 758 Bytes
Contents
require 'rails_helper' RSpec.describe Categorical::Tag, type: :model do it_behaves_like "a sluggable" 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
exposition-0.0.5.5.pre.alpha | spec/models/categorical/tag_spec.rb |