Sha256: eb3a3e4e0da90c82b9279fa7e4ec3135178de9310dd06213ebf031e32e8d0237

Contents?: true

Size: 1.21 KB

Versions: 60

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe "Store::Payment", "REST methods" do

  before do
    payments = File.read("spec/fixtures/caren_payments.xml")
    payments_search = File.read("spec/fixtures/caren_payments_search.xml")

    payments_url = Caren::Api.session.url_for( Caren::Store::Payment.resource_url )
    search_url = Caren::Api.session.url_for( "#{Caren::Store::Payment.resource_url}?key=status&value=failed" )

    timestamp = DateTime.now.to_i

    FakeWeb.register_uri(:get, payments_url, :body => payments, :timestamp => timestamp, :signature => Caren::Api.session.sign(timestamp,nil,payments) )
    FakeWeb.register_uri(:get, search_url, :body => payments_search, :timestamp => timestamp, :signature => Caren::Api.session.sign(timestamp,nil,payments_search) )
  end

  it "should be able to search for a specific billable category" do
    payments_search = Caren::Store::Payment.search :status, "failed", Caren::Api.session
    payments_search.should have(1).things
    payments_search.first.status.should == "failed"
  end

  it "should be able to find all billable category" do
    payments = Caren::Store::Payment.all Caren::Api.session
    payments.should have(2).things
    payments.first.status.should == "paid"
  end

end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
caren-api-0.12.5 spec/store/payment_spec.rb
caren-api-0.12.4 spec/store/payment_spec.rb
caren-api-0.12.3 spec/store/payment_spec.rb
caren-api-0.12.2 spec/store/payment_spec.rb
caren-api-0.12.1 spec/store/payment_spec.rb
caren-api-0.12.0 spec/store/payment_spec.rb
caren-api-0.11.1 spec/store/payment_spec.rb
caren-api-0.11.0 spec/store/payment_spec.rb
caren-api-0.10.0 spec/store/payment_spec.rb
caren-api-0.9.10 spec/store/payment_spec.rb
caren-api-0.9.9 spec/store/payment_spec.rb
caren-api-0.9.8 spec/store/payment_spec.rb
caren-api-0.9.7 spec/store/payment_spec.rb
caren-api-0.9.6 spec/store/payment_spec.rb
caren-api-0.9.4 spec/store/payment_spec.rb
caren-api-0.9.3 spec/store/payment_spec.rb
caren-api-0.9.2 spec/store/payment_spec.rb
caren-api-0.9.1 spec/store/payment_spec.rb
caren-api-0.9.0 spec/store/payment_spec.rb
caren-api-0.8.0 spec/store/payment_spec.rb