Sha256: 8f8ee5d0bd84085cfe10f215e0da3cbe08060936fb152c3253c5f9ceaac981eb

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

describe ::PPC::API::Sm::Plan do

  auth = $sm_auth 
  test_plan_id = 0
  plan_service = ::PPC::API::Sm::Plan

  it "can get all plans" do
    response = plan_service.all( auth )
    p response
    expect(response[:succ]).to be true
  end
  it "can get all plan ids" do 
    response = plan_service.ids( auth )
    p response
    expect(response[:succ]).to be true
    expect(response[:result].is_a? Array).to be true
  end
  it "can add a new plan and get its id" do
    response = plan_service.add(auth, {name: 'test_2', pause: true})
    p response
    expect(response[:succ]).to be true
    new_plan = response[:result][0]
    expect(new_plan.class).to eql Hash
    expect(new_plan[:id]).to be > 0 
    test_plan_id = new_plan[:id]
  end
  it "can get a plan by id" do
    response = plan_service.get(auth, test_plan_id)
    p response
    plan = response[:result][0]
    expect(plan.class).to eql Hash
    expect(plan[:pause]).to be true
  end
  it "can delete a plan by id" do 
    response = plan_service.delete(auth, test_plan_id)
    p response
    expect(response[:succ]).to be true
  end
end 

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ppc-2.0.5 spec/sm/api_sm_plan_spec.rb
ppc-2.0.4 spec/sm/api_sm_plan_spec.rb
ppc-2.0.3 spec/sm/api_sm_plan_spec.rb
ppc-2.0.2 spec/sm/api_sm_plan_spec.rb
ppc-2.0.1 spec/sm/api_sm_plan_spec.rb
ppc-2.0.0 spec/sm/api_sm_plan_spec.rb
ppc-1.3.2 spec/sm/api_sm_plan_spec.rb