Sha256: 42a914734656a6d70c49d1bcc50d80575ed5b1fc90ba681d0d2a5002b1314b90

Contents?: true

Size: 942 Bytes

Versions: 2

Compression:

Stored size: 942 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))


describe RTurk::Notification do
  before(:each) do
    @notification = RTurk::Notification.new
  end

  it "should not allow extra parameters" do
    lambda {
      @notification[:Bananas]
    }.should raise_error NameError
  end

  describe "#to_param_hash" do
    it "should not allow for empty params" do
      lambda {
        @notification.to_param_hash
      }.should raise_error RTurk::MissingParameters
    end

    it "should return a REST-friendly hash" do
      @notification.destination = 'foo'
      @notification.transport = 'bar'
      @notification.event_type = 'mumble'

      @notification.to_param_hash.should ==
        { "Notification.1.Destination" => 'foo',
          "Notification.1.Transport" => 'bar',
          "Notification.1.Version" => RTurk::OLD_API_VERSION,
          "Notification.1.EventType" => 'mumble' }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rturk-2.1.0 spec/builders/notification_builder_spec.rb
rturk-2.0.5 spec/builders/notification_builder_spec.rb