Sha256: c5360c6bd5af1854713a4262b05b3cb49f5bc4af5be8215747d35b6bc4ee9212

Contents?: true

Size: 589 Bytes

Versions: 1

Compression:

Stored size: 589 Bytes

Contents

require 'test_helper'

class TopicTest < ActiveSupport::TestCase
  Topic.all.each do |topic|
    test "friendly database slug filters out ##{topic.id} title" do
      topic.slug = nil
      assert_equal(TestAnswers::TOPIC_ONE_PARAM_ANSWERS[topic.id], topic.to_param)
    end
  end

  test "friendly database slug filters out a new topic title" do
    topic = Topic.create!(title: "Baby This Is a New Topic")
    assert_equal(topic.to_param, "baby-this-is-a-new-topic")

    topic.update(title: "My Newly Updated Title")
    assert_equal(topic.to_param, "my-newly-updated-title")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
friendly_slug-0.1.6 friendly_slug_gem_test/test/models/topic_test.rb