Sha256: a7ccefacb8d65063fb4e0f414d8402205f3ecea636950f7b34dccb86e49610ec

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Wordnik::Operation do

  before(:each) do
    VCR.use_cassette('words', :record => :new_episodes) do
      @response = Typhoeus::Request.get("http://api.wordnik.com/v4/word.json")
    end
    @resource = Wordnik::Resource.new(:name => "word", :raw_data => JSON.parse(@response.body))
    @endpoint = @resource.endpoints.first
    @operation = @endpoint.operations.first
  end

  describe "initialization" do

    it "successfully initializes" do
      @operation.summary.should =~ /returns the WordObject/i
    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

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wordnik-0.4.5 spec/operation_spec.rb
wordnik-0.4.4 spec/operation_spec.rb
wordnik-0.4.3 spec/operation_spec.rb
wordnik-0.4.2 spec/operation_spec.rb
wordnik-0.4.1 spec/operation_spec.rb