Sha256: 16ac10965fa3058b833dac52c4467eb7f4268ced43499895614bf0d78a3a5dfe

Contents?: true

Size: 1.59 KB

Versions: 19

Compression:

Stored size: 1.59 KB

Contents

require 'core/spec_helper'

describe ZendeskAPI::AppInstallation do
  it "should work "do
    upload = VCR.use_cassette("app_installations_upload_create") do
      ZendeskAPI::App::Upload.new(client, :id => "spec/fixtures/sample_app.zip").tap(&:save!)
    end

    attributes = { :upload_id => upload.id, :name => "My App", :short_description => "Testing" }

    app = ZendeskAPI::App.new(client, attributes)

    VCR.use_cassette("app_installations_create") { app.save! }

    body = {}

    VCR.use_cassette("app_installations_create_job_status") do
      until %w{failed completed}.include?(body["status"])
        response = client.connection.get(app.response.headers["Location"])
        body = response.body

        sleep(3)
      end
    end

    if body["status"] == "failed"
      fail "Could not create app: #{body.inspect}"
    end

    app.id = body["app_id"]

    attributes = { :app_id => app.id, :settings => {
        :name => "My App",
        "Custom_Field_ID" => "123",
        "Custom_Field_Default" => "Default"
      }
    }

    install = ZendeskAPI::AppInstallation.new(client, attributes)

    VCR.use_cassette("app_install_create") { install.save! }

    installations = client.app.installations
    VCR.use_cassette("app_install_fetch") { installations.fetch! }

    installations.should include(install)

    install.settings.name = "My New Name"
    VCR.use_cassette("app_install_update") { install.save! }

    install.settings.title.should == "My New Name"

    VCR.use_cassette("app_install_destroy") { install.destroy! }

    VCR.use_cassette("app_installations_destroy") { app.destroy! }
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
zendesk_api-1.3.7 spec/live/app_installation_spec.rb
zendesk_api-1.2.10 spec/live/app_installation_spec.rb
zendesk_api-1.2.9 spec/live/app_installation_spec.rb
zendesk_api-1.2.8 spec/live/app_installation_spec.rb
zendesk_api-1.3.5 spec/live/app_installation_spec.rb
zendesk_api-1.2.7 spec/live/app_installation_spec.rb
zendesk_api-1.3.4 spec/live/app_installation_spec.rb
zendesk_api-1.3.2 spec/live/app_installation_spec.rb
zendesk_api-1.3.1 spec/live/app_installation_spec.rb
zendesk_api-1.3.0 spec/live/app_installation_spec.rb
zendesk_api-1.3.0.rc3 spec/live/app_installation_spec.rb
zendesk_api-1.2.6 spec/live/app_installation_spec.rb
zendesk_api-1.3.0.rc2 spec/live/app_installation_spec.rb
zendesk_api-1.3.0.rc1 spec/live/app_installation_spec.rb
zendesk_api-1.2.5 spec/live/app_installation_spec.rb
zendesk_api-1.2.4 spec/live/app_installation_spec.rb
zendesk_api-1.2.3 spec/live/app_installation_spec.rb
zendesk_api-1.2.2 spec/live/app_installation_spec.rb
zendesk_api-1.2.1 spec/live/app_installation_spec.rb