Sha256: 2a9e0d2126f05752b37e0da27c403c7a822c796b36dc1b6383ec18ef4c563e99

Contents?: true

Size: 556 Bytes

Versions: 2

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(:usec)}", issue.cache_key
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
superstore-3.0.0 test/unit/caching_test.rb
superstore-2.5.0 test/unit/caching_test.rb