Sha256: 097e35c1a03e89bb6341c3c7b631e113fe5832b01a9b8401ccd7ff769467e35f

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe ActsAsAmico do
  before :all do
    FakeWeb.allow_net_connect = false
    @all_resp = '<rest_objects type="array">
                  <rest_object><id>123</id><title>Blah</title><description>Some stuff</description></rest_object>
                  <rest_object><id>321</id><title>Blah</title><description>Some stuff</description></rest_object>
                </rest_objects>'
    @resp_123 = '<rest_object><id>123</id><title>Blah</title><description>Some stuff</description></rest_object>'
    @resp_321 = '<rest_object><id>321</id><title>Blah</title><description>Some stuff</description></rest_object>'

    FakeWeb.register_uri(:get, "http://api.sample.com/rest_objects/123.xml", :body => @resp_123, :status => ["200", "OK"])
    FakeWeb.register_uri(:get, "http://api.sample.com/rest_objects/321.xml", :body => @resp_321, :status => ["200", "OK"])
  end

  after :all do
    FakeWeb.allow_net_connect=true
  end

  before :each do
    @usera = Factory :user
    @admin = Factory :admin
    @rest_object = RestObject.find(321)
  end

  it "should hold an amico_key" do
    @rest_object.class.amico_key.should eq(:title)
  end

  it "should allow following an ActiveResource object" do
    @usera.follow! @rest_object, 'rest_object'
#    @usera.following?(@rest_object).should be_true

#    @rest_object.followers.include?(@usera.id).should be_true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_amico-0.2.0 spec/active_resource_spec.rb