Sha256: ee188e4cc9fe952c6a434e9b0b9dc84f1966d8c1b9e0f11d3bb87199bff821d5

Contents?: true

Size: 1.35 KB

Versions: 9

Compression:

Stored size: 1.35 KB

Contents

require "spec_helper"

module Lumberg
  describe Cpanel::Contact do
    let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
    let(:api_username) { "lumberg" }
    let(:contact) do
      described_class.new(
        server:       server,
        api_username: api_username
      )
    end

    subject { contact }

    describe "::api_module" do
      subject { described_class::api_module }

      it { should == "CustInfo" }
    end

    describe "#show" do
      use_vcr_cassette("cpanel/contact/show", record: :new_episodes)
      subject { contact.show[:params][:data].first[:enabled] }
      it { should == 1 }
    end

    describe "#update" do
      let(:email_address) { "testing@lumberg-test.com" }
      let(:result) { Hash.new }

      use_vcr_cassette("cpanel/contact/update")

      context "configure contact email address and enables notifications" do
        it "should setup email address and bandwidth limit notification" do
          res = contact.update({ email: email_address, bandwidth: 1 })

          res[:params][:data].collect do |r|
            if ((r[:name] == 'email') or (r[:name] == 'notify_bandwidth_limit'))
              result[:"#{r[:name]}"] = r[:value]
            end
          end

          result[:email].should === email_address
          result[:notify_bandwidth_limit].should === 1
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lumberg-4.1.0 spec/cpanel/contact_spec.rb
lumberg-4.0.0 spec/cpanel/contact_spec.rb
lumberg-3.1.0 spec/cpanel/contact_spec.rb
lumberg-3.0.0 spec/cpanel/contact_spec.rb
lumberg-2.0.1 spec/cpanel/contact_spec.rb
lumberg-2.0.0 spec/cpanel/contact_spec.rb
lumberg-2.0.0.pre20 spec/cpanel/contact_spec.rb
lumberg-2.0.0.pre18 spec/cpanel/contact_spec.rb
lumberg-2.0.0.pre15 spec/cpanel/contact_spec.rb