Sha256: b4c00e35fd2feb0a605d1bd90c53018645df9e40f2e2758ce16a26a18a728d06

Contents?: true

Size: 1 KB

Versions: 4

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe Gecko::Pusher::Channel::Rag do

  before(:each) do
    WebMock.reset!
    Gecko::Pusher.api_key = API_KEY
    @channel = Gecko::Pusher.channel(:rag, WIDGET_KEY)
  end

  it "should initiate a RAG channel" do
    @channel.should be_a(Gecko::Pusher::Channel::Rag)
  end

  it "should push RAG values" do
    data = {
      item: [
        { value: 100 },
        { value: 200 },
        { value: 300 }
      ]
    }
    stub = stub_gecko_post(WIDGET_KEY, data)
    @channel.push(100, 200, 300)
    stub.should have_been_requested
  end

  it "should push RAG values and descriptions" do
    data = {
      item: [
        { value: 100, text: "red description" },
        { value: 200, text: "amber description" },
        { value: 300, text: "green description" }
      ]
    }
    stub = stub_gecko_post(WIDGET_KEY, data)
    @channel.push(100, "red description",
                  200, "amber description",
                  300, "green description")
    stub.should have_been_requested
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gecko-pusher-0.0.4 spec/lib/gecko-pusher/channel/rag_spec.rb
gecko-pusher-0.0.3 spec/lib/gecko-pusher/channel/rag_spec.rb
gecko-pusher-0.0.2 spec/lib/gecko-pusher/channel/rag_spec.rb
gecko-pusher-0.0.1 spec/lib/gecko-pusher/channel/rag_spec.rb