Sha256: 2317916cf796a7c1eb26a4bcf6e21d445ebdf1e42f6aed0d5ccd2a3284dd782b

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require File.expand_path('../../spec_helper', __FILE__)

describe Genability::Client do

  Genability::Configuration::VALID_FORMATS.each do |format|

    context ".new(:format => '#{format}')" do

      use_vcr_cassette "echo"

      before(:all) do
        @options = {:format => format}.merge(configuration_defaults)
        @client = Genability::Client.new(@options)
      end

      context ".credentials_valid?" do

        it "should be successful with valid appId and appKey" do
          @client.credentials_valid?.should be_true
        end

      end

      context ".validate" do

        it "should validate a properly formatted date" do
          date = @client.send(:format_to_iso8601, "October 26th, 2011")
          @client.validate('dateTime', date).date_time.should == "2011-10-26T12:00:00-04:00"
        end

      end

      context ".raise_error" do

        it "should simulate an error response" do
          lambda do
            @client.raise_error(500)
          end.should raise_error Genability::ServerError
        end

      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
genability-0.3.0 spec/client/echo_spec.rb