Sha256: 35b32d4157dfed4dc7aca11f8ccfd459fd65f777c7a4c2310f36ae04c2f20f21

Contents?: true

Size: 1 KB

Versions: 91

Compression:

Stored size: 1 KB

Contents

# encoding: utf-8
#
require 'spec_helper'

describe Picky::Category, "Realtime API" do

  Thing = Struct.new :id, :text

  let(:category) do
    index    = Picky::Index.new :some_index_name
    category = described_class.new :text, index
  end

  it 'offers an add method' do
    category.add Thing.new(1, 'text')
  end
  it 'offers a remove method' do
    category.remove 1
  end
  it 'offers a replace method' do
    category.replace Thing.new(1, 'text')
  end
  it 'offers a << method' do
    category << Thing.new(1, 'text')
  end
  # it 'offers a >> method' do
  #   Thing.new(1, 'text') >> category # I mean, as long as we're dreaming.
  # end
  it 'offers an unshift method' do
    category.unshift Thing.new(1, 'text')
  end
  it 'offers a replace_from method' do
    category.replace_from id: 1, text: "some text"
  end
  it 'raises on no id given' do
    expect {
      category.replace_from text: "some text"
    }.to raise_error
  end
  it 'shrugs off no data given' do
    category.replace_from id: 1
  end

end

Version data entries

91 entries across 91 versions & 1 rubygems

Version Path
picky-4.22.0 spec/lib/category_realtime_spec.rb
picky-4.21.2 spec/lib/category_realtime_spec.rb
picky-4.21.1 spec/lib/category_realtime_spec.rb
picky-4.21.0 spec/lib/category_realtime_spec.rb
picky-4.20.2 spec/lib/category_realtime_spec.rb
picky-4.20.1 spec/lib/category_realtime_spec.rb
picky-4.20.0 spec/lib/category_realtime_spec.rb
picky-4.19.7 spec/lib/category_realtime_spec.rb
picky-4.19.6 spec/lib/category_realtime_spec.rb
picky-4.19.5 spec/lib/category_realtime_spec.rb
picky-4.19.4 spec/lib/category_realtime_spec.rb
picky-4.19.3 spec/lib/category_realtime_spec.rb
picky-4.19.2 spec/lib/category_realtime_spec.rb
picky-4.19.1 spec/lib/category_realtime_spec.rb
picky-4.19.0 spec/lib/category_realtime_spec.rb
picky-4.18.0 spec/lib/category_realtime_spec.rb
picky-4.17.1 spec/lib/category_realtime_spec.rb
picky-4.17.0 spec/lib/category_realtime_spec.rb
picky-4.16.0 spec/lib/category_realtime_spec.rb
picky-4.15.1 spec/lib/category_realtime_spec.rb