Sha256: f14a1451f406e578db929d32e7114ef75019bf6995c033834901d2e8774d368c

Contents?: true

Size: 949 Bytes

Versions: 2

Compression:

Stored size: 949 Bytes

Contents

require 'spec_helper'

describe Dineromail::Notification do
  it 'should load the notifications from the notification xml' do
    notification_xml = File.read( 'spec/fixtures/notification.xml')
    notifications = Dineromail::Notification.parse(notification_xml)
    notifications.count.should == 2
    notifications.first.transaction_id.should == 1889
    notifications.last.transaction_id.should == 5547
  end
  
  it 'should get automaticaly the status data associated with the notification' do
    HTTParty.stub!(:get).and_return {
      response = Object.new
      response.stub!(:body).and_return(File.read( 'spec/fixtures/status_report.xml'))
      response
    }
    notification_xml = File.read( 'spec/fixtures/notification.xml')
    notifications = Dineromail::Notification.parse(notification_xml)
    notification = notifications.first
    notification.valid_report?.should be_true
    notification.net_amount.should == 50.3
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dineromail-0.1.1 spec/dineromail/notification_spec.rb
dineromail-0.1.0 spec/dineromail/notification_spec.rb