Sha256: 10230accd3d2fc5b34edb3f85c1d5894aa332e86493ec2b0f2031e66f40f612d

Contents?: true

Size: 1.86 KB

Versions: 46

Compression:

Stored size: 1.86 KB

Contents

require 'spec_helper'

describe FbGraph::Order do
  subject { order }
  let(:order) { FbGraph::Order.new attributes[:id], attributes }
  let :attributes do
    {
      :id => '9005539514450',
      :from => {
        :name => 'Nov Matake',
        :id => '579612276'
      },
      :to => {
        :name => 'Nov Matake',
        :id => '579612276'
      },
      :amount => 2,
      :status => 'settled',
      :application => {
        :name => 'gem sample',
        :id => '134145643294322'
      },
      :created_time => '2011-09-01T04:34:35+0000',
      :updated_time => '2011-09-01T04:34:38+0000'
    }
  end

  its(:identifier)   { should == '9005539514450' }
  its(:from)         { should == FbGraph::User.new('579612276', :name => 'Nov Matake') }
  its(:to)           { should == FbGraph::User.new('579612276', :name => 'Nov Matake') }
  its(:application)  { should == FbGraph::Application.new('134145643294322', :name => 'gem sample') }
  its(:amount)       { should == 2 }
  its(:status)       { should == 'settled' }
  its(:created_time) { should == Time.parse('2011-09-01T04:34:35+0000') }
  its(:updated_time) { should == Time.parse('2011-09-01T04:34:38+0000') }

  describe '#settle!' do
    it do
      expect { order.settle! }.should request_to order.identifier, :post
    end

    it 'I have never succeeded this call yet'
  end

  describe '#refund!' do
    it do
      expect { order.refund! }.should request_to order.identifier, :post
    end

    it 'should return true' do
      mock_graph :post, order.identifier, 'true', :access_token => 'access_token', :params => {
        :status => 'refunded'
      } do
        order.refunded!(:access_token => 'access_token').should be_true
      end
    end
  end

  describe '#cancel!' do
    it do
      expect { order.cancel! }.should request_to order.identifier, :post
    end

    it 'I have never succeeded this call yet'
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
fb_graph-2.4.17 spec/fb_graph/order_spec.rb
fb_graph-2.4.16 spec/fb_graph/order_spec.rb
fb_graph-2.4.15 spec/fb_graph/order_spec.rb
fb_graph-2.4.14 spec/fb_graph/order_spec.rb
fb_graph-2.4.13 spec/fb_graph/order_spec.rb
fb_graph-2.4.12 spec/fb_graph/order_spec.rb
fb_graph-2.4.11 spec/fb_graph/order_spec.rb
fb_graph-2.4.10 spec/fb_graph/order_spec.rb
fb_graph-2.4.9 spec/fb_graph/order_spec.rb
fb_graph-2.4.8 spec/fb_graph/order_spec.rb
fb_graph-2.4.7 spec/fb_graph/order_spec.rb
fb_graph-2.4.6 spec/fb_graph/order_spec.rb
fb_graph-2.4.4 spec/fb_graph/order_spec.rb
fb_graph-2.4.3 spec/fb_graph/order_spec.rb
fb_graph-2.4.2 spec/fb_graph/order_spec.rb
fb_graph-2.4.1 spec/fb_graph/order_spec.rb
fb_graph-2.4.0 spec/fb_graph/order_spec.rb
fb_graph-2.3.2 spec/fb_graph/order_spec.rb
fb_graph-2.3.1 spec/fb_graph/order_spec.rb
fb_graph-2.3.0 spec/fb_graph/order_spec.rb