Sha256: bbae727578334160521f923b7e6898db8d63e61929fea6376d29e403f887e68b

Contents?: true

Size: 876 Bytes

Versions: 1

Compression:

Stored size: 876 Bytes

Contents

require "spec_helper"

describe "The Smooth Command" do
  let(:command) { Smooth.current_api.resource("Books").fetch(:command, :like) }

  it "should allow for descriptions of the filters" do
    expect(command.input_descriptions[:like]).not_to be_blank
    expect(command.input_descriptions[:left_out]).to be_blank
  end

  it "should know the resource name" do
    expect(command.resource_name).to eq("Books")
  end

  it "should know the command action" do
    expect(command.command_action).to eq("like")
  end

  it "should know the event namespace" do
    expect(command.event_namespace).to eq("like.book")
  end

  describe "Event Tracking Integration" do
    it "should track events" do
      bucket = []

      Smooth.subscribe_to(/like.book/)  do |event|
        bucket << event
      end

      command.run()

      expect(bucket).not_to be_empty
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smooth-2.0.1 spec/lib/smooth/command_spec.rb