Sha256: a8f3ba50f8dfbcba67f384d7fe36c490ad8b9d27f8505bb408df682099cbbebf

Contents?: true

Size: 1.27 KB

Versions: 39

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'
require 'cucumber/wire_support/wire_language'

module Cucumber
  module WireSupport
    describe WirePacket do

      describe "#to_json" do
        it "should convert params to a JSON hash" do
          packet = WirePacket.new('test_message', :foo => :bar)
          packet.to_json.should == "[\"test_message\",{\"foo\":\"bar\"}]"
        end
        
        it "should not pass blank params" do
          packet = WirePacket.new('test_message')
          packet.to_json.should == "[\"test_message\"]"
        end
      end
      
      describe ".parse" do
        it "should understand a raw packet containing null parameters" do
          packet = WirePacket.parse("[\"test_message\",null]")
          packet.message.should == 'test_message'
          packet.params.should be_nil
        end

        it "should understand a raw packet containing no parameters" do
          packet = WirePacket.parse("[\"test_message\"]")
          packet.message.should == 'test_message'
          packet.params.should be_nil
        end
        
        it "should understand a raw packet containging parameters data" do
          packet = WirePacket.parse("[\"test_message\",{\"foo\":\"bar\"}]")
          packet.params['foo'].should == 'bar'
        end
      end
    end
  end
end

Version data entries

39 entries across 37 versions & 9 rubygems

Version Path
candlepin-api-0.4.0 bundle/ruby/gems/cucumber-1.2.1/spec/cucumber/wire_support/wire_packet_spec.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/cucumber-1.2.1/spec/cucumber/wire_support/wire_packet_spec.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/cucumber-1.2.1/spec/cucumber/wire_support/wire_packet_spec.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/cucumber-1.2.1/spec/cucumber/wire_support/wire_packet_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/cucumber-1.2.1/spec/cucumber/wire_support/wire_packet_spec.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/cucumber-1.2.1/spec/cucumber/wire_support/wire_packet_spec.rb
casecumber-1.0.2.1 spec/cucumber/wire_support/wire_packet_spec.rb
casecumber-1.2.1.cb2 spec/cucumber/wire_support/wire_packet_spec.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/cucumber-1.2.1/spec/cucumber/wire_support/wire_packet_spec.rb
cucumber-1.2.1 spec/cucumber/wire_support/wire_packet_spec.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/wire_support/wire_packet_spec.rb
ftl-0.2.0 vendor/bundle/gems/cucumber-1.2.0/spec/cucumber/wire_support/wire_packet_spec.rb
cucumber-1.2.0 spec/cucumber/wire_support/wire_packet_spec.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/wire_support/wire_packet_spec.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/wire_support/wire_packet_spec.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/wire_support/wire_packet_spec.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/wire_support/wire_packet_spec.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/wire_support/wire_packet_spec.rb
resque-pool-0.3.0.beta.2 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/wire_support/wire_packet_spec.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/wire_support/wire_packet_spec.rb