Sha256: 934b7c828d5cbd709879b78ee058e85ab9e99652a6479c7c9f59b26b1146d509

Contents?: true

Size: 1.01 KB

Versions: 13

Compression:

Stored size: 1.01 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
      expect(@model.destroyed?).to eq(false)
    end
  end

  describe 'destroy' do

    it "should be destroyable" do
      stub_api_delete("/some/place/20101230223226074201000000")
      @model = MyExampleModel.first
      @model.destroy
      expect(@model.destroyed?).to 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-2.0.0 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.6.3 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.6.2 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.6.1 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.5.7 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.6.0 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.5.6 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.5.5 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.5.4 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.5.3 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.5.2 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.5.1 spec/unit/spark_api/models/concerns/destroyable_spec.rb
spark_api-1.5.0 spec/unit/spark_api/models/concerns/destroyable_spec.rb