Sha256: e8d4754a126645bf1075d576b8621eb4eb9b55834f3d71094aa713c6dbc76760

Contents?: true

Size: 1 KB

Versions: 13

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

class MyExampleModel < Base
  include Concerns::Destroyable
  self.prefix = "/test/"
  self.element_name = "example"
end

describe Concerns::Destroyable, "Destroyable Concern" do

  before :each do
    stub_auth_request
    stub_api_get("/test/example", 'base.json')
    @model = MyExampleModel.first
  end

  describe 'destroyed?' do
    
    it "should not be destroyed" do
      @model.destroyed?.should eq(false)
    end
  end

  describe 'destroy' do

    it "should be destroyable" do
      stub_api_delete("/some/place/20101230223226074201000000")
      @model = MyExampleModel.first
      @model.destroy
      @model.destroyed?.should eq(true)
    end

  end

  describe 'destroy class method' do

    it "allows you to destroy with only the id" do
      stub_api_delete("/test/example/20101230223226074201000000")
      MyExampleModel.destroy('20101230223226074201000000')
      expect_api_request(:delete, "/test/example/20101230223226074201000000").to have_been_made.once
    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
spark_api-1.4.34 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.4.32 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.4.31 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.4.29 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.4.28 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.4.27 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.4.26 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.4.25 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.4.24 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.4.23 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.4.22 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.4.21 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.4.20 spec/unit/spark_api/models/concerns/destroyable_spec.rb