Sha256: 4be4b5f740b35161a184b537f64dbc29220ef46a609e467badcf174c0f9176bb

Contents?: true

Size: 865 Bytes

Versions: 3

Compression:

Stored size: 865 Bytes

Contents

require 'test_helper'

# class BookTest < ActiveSupport::TestCase
#   test "the truth" do
#     assert true
#   end
# end

describe Book do

  let (:book) { create :book, id: 1 }

  it "should have Fastly::SurrogateKey instance methods" do

    [:record_key, :table_key, :purge, :purge_all].each do |method|
      assert_respond_to book, method
    end

  end

  it "should have Fastly::SurrogateKey class methods" do

    [:table_key, :purge_all].each do |method|
      assert_respond_to Book, method
    end

  end

  it "should have a record_key of books/1" do
    assert_equal 'books/1', book.record_key
  end

  it "should have a table_key that returns its table name" do
    assert_equal 'books', book.table_key
  end

  it "should have class.table_key and instance.table_key that are equivalent" do
    assert_equal Book.table_key, book.table_key
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fastly-rails-0.1.2 test/dummy/test/models/book_test.rb
fastly-rails-0.1.1 test/dummy/test/models/book_test.rb
fastly-rails-0.1.0 test/dummy/test/models/book_test.rb