Sha256: 14b6baa192658e178decfa7ff0f3990cc534dbf611f636ebb82b5b95fcf4b6ef

Contents?: true

Size: 1.13 KB

Versions: 15

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe Homeflow::API::Queryable do
  context "When used by a class" do

    it "should provide a where method generating a query" do
      query =  Homeflow::API::Property.where(:test => :argument)
      query.class.should == Homeflow::API::Query
      query.query.should == {:test => :argument}
    end

    it "should cause the implementing class to recive a message on execute" do
      query =  Homeflow::API::Property.where(:test => :argument)
      Homeflow::API::Property.should_receive(:execute).with(query)
      query.results
    end

  end
end


describe Homeflow::API::Resource do
  context "When inhereted by a class" do

    it "should cause the implementing class to recive a message when find is called" do
      data = File.read(File.dirname(__FILE__) + '/data/property_details.json')
      Homeflow::API::Request.any_instance.should_receive(:perform).and_return(data)
      property =  Homeflow::API::Property.find(2).property
      property.class.should == Homeflow::API::Property
    end


     it "should provide uri" do
      Homeflow::API::Property.resource_uri.should == 'properties'
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
homeflow_api-1.0.3 spec/query_spec.rb
homeflow_api-1.0.2 spec/query_spec.rb
homeflow_api-1.0.1 spec/query_spec.rb
homeflow_api-1.0.0 spec/query_spec.rb
homeflow_api-0.17.15 spec/query_spec.rb
homeflow_api-0.17.14 spec/query_spec.rb
homeflow_api-0.17.13 spec/query_spec.rb
homeflow_api-0.17.12 spec/query_spec.rb
homeflow_api-0.17.11 spec/query_spec.rb
homeflow_api-0.17.9 spec/query_spec.rb
homeflow_api-0.17.8 spec/query_spec.rb
homeflow_api-0.17.6 spec/query_spec.rb
homeflow_api-0.17.5 spec/query_spec.rb
homeflow_api-0.17.4 spec/query_spec.rb
homeflow_api-0.17.3 spec/query_spec.rb