Sha256: 4da6b31e1a86c879c7d9fbf7f98abe7ef673754b9216a186bb010e94fc93a7c0

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

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 allow alphanumeric transaction ids' do
    notification_xml = File.read( 'spec/fixtures/notification_alphanumeric_id.xml')
    notifications = Dineromail::Notification.parse(notification_xml)
    notifications.first.transaction_id.should == 'ABC123'
  end
  
  it 'should get automaticaly the status data associated with the notification' do
    HTTParty.stub!(:get).and_return {
      stub :body => File.read( 'spec/fixtures/status_report.xml')
    }
    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.2.1 spec/dineromail/notification_spec.rb
dineromail-0.2.0 spec/dineromail/notification_spec.rb