Sha256: 6ba3c8ce073142ab6b411040bdaeaa5ddc8a2e6ac580930435516c794183beb4

Contents?: true

Size: 556 Bytes

Versions: 8

Compression:

Stored size: 556 Bytes

Contents

require 'test_helper'

class Superstore::CachingTest < Superstore::TestCase
  class ::OtherClass < Superstore::Base
    self.table_name = 'issues'
  end

  test 'for a new record' do
    issue = Issue.new
    other_class = OtherClass.new
    assert_equal "issues/new", issue.cache_key
    assert_equal "other_classes/new", other_class.cache_key
  end

  test 'for a persisted record' do
    updated_at = Time.now
    issue = Issue.create!(id: 1, updated_at: updated_at)

    assert_equal "issues/1-#{updated_at.utc.to_s(:nsec)}", issue.cache_key
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
superstore-2.4.4 test/unit/caching_test.rb
superstore-2.4.3 test/unit/caching_test.rb
superstore-2.4.2 test/unit/caching_test.rb
superstore-2.4.1 test/unit/caching_test.rb
superstore-2.4.0 test/unit/caching_test.rb
superstore-2.3.0 test/unit/caching_test.rb
superstore-2.2.0 test/unit/caching_test.rb
superstore-2.1.3 test/unit/caching_test.rb