Sha256: 5e27aa65b1386bbf3ccd0ce4abc66c9e516227846cf60d6ecc2b9be1d49a42cc

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe Belajar::Storeable do

  it "responds to ::key" do
    expect(Belajar::Storeable).to respond_to :key
  end

  describe '::key' do
    it "creates a store key from the given string" do
      key = Belajar::Storeable.key('1-_Raw content-Title')
      expect(key).to eq 'raw_content_title'
    end

    it "creates a cleaned up store key from a given path string" do
      key = Belajar::Storeable.key('path/to/the/1-_Raw content string')
      expect(key).to eq 'path/to/the/raw_content_string'
    end

    it "creates a prefixed key when a prefix option is given" do
      key = Belajar::Storeable.key('1-_Raw content-Title', prefix: 'courses')
      expect(key).to eq 'courses/raw_content_title'
    end

    it "creates a suffixed key if a suffix option is given" do
      key = Belajar::Storeable.key('1-_Raw content-Title', suffix: '1-author')
      expect(key).to eq 'raw_content_title/author'
    end

    it "creates a multi suffixed key if a suffixes option is given" do
      key = Belajar::Storeable.key('1-_Raw content-Title', suffixes: ['meta', '1-author'] )
      expect(key).to eq 'raw_content_title/meta/author'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
belajar-0.1.1 spec/belajar/storeable_spec.rb