Sha256: 7c70b7a9dbf721ca0db146f5a35a6484c2cf140976f7b93338c2445de9059ccd

Contents?: true

Size: 1.14 KB

Versions: 15

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe Wordnik::Operation do

  before(:each) do
    @resource = Wordnik::Resource.new(:name => "word", :raw_data => JSON.parse(sample_resource_body))
    @endpoint = @resource.endpoints.first
    @operation = @endpoint.operations.first
  end

  describe "initialization" do

    it "successfully initializes" do
      @operation.summary.should_not be_nil
    end

    it "sets parameters" do
      @operation.parameters.class.should == Array
      @operation.parameters.first.class.should == Wordnik::OperationParameter
    end

  end

  describe "instance methods" do
    it "knows if its HTTP method is GET" do
      @operation.http_method = "GET"
      @operation.get?.should == true
      @operation.http_method = "POST"
      @operation.get?.should == false
      @operation.http_method = "get"
      @operation.get?.should == true
    end
  end
  
  describe "positional parameter names" do
    
    it "returns an empty array if there are no parameters" do
      @operation.positional_parameter_names.should == ['word']
      @operation.parameters = []
      @operation.positional_parameter_names.should == []
    end
    
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
wordnik-4.12 spec/operation_spec.rb
wordnik-4.11 spec/operation_spec.rb
wordnik-4.10 spec/operation_spec.rb
wordnik-4.09 spec/operation_spec.rb
wordnik-4.08 spec/operation_spec.rb
wordnik-4.07 spec/operation_spec.rb
wordnik-4.06.15 spec/operation_spec.rb
wordnik-4.06.14 spec/operation_spec.rb
wordnik-4.06.13 spec/operation_spec.rb
wordnik-4.06.12 spec/operation_spec.rb
wordnik-4.06.11 spec/operation_spec.rb
wordnik-4.06.10 spec/operation_spec.rb
wordnik-4.06.08 spec/operation_spec.rb
wordnik-4.06.07 spec/operation_spec.rb
wordnik-4.06.06 spec/operation_spec.rb