Sha256: 65d26b1c2685cef3155cd7274ccb30e1a92754acc99972ab5b19332b15895389

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe Admin::OrdersController do

  let(:order) { mock_model(Order, :complete? => true, :total => 100) }

  before do
    controller.stub :current_user => nil
    Order.stub :find_by_number => order
    request.env["HTTP_REFERER"] = "http://localhost:3000"
  end

  context "#fire" do
    it "should fire the requested event on the payment" do
      order.should_receive(:foo).and_return true
      put :fire, {:id => "R1234567", :e => "foo"}
    end
    it "should respond with a flash message if the event cannot be fired" do
      order.stub :foo => false
      put :fire, {:id => "R1234567", :e => "foo"}
      flash[:error].should_not be_nil
    end
  end

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
MyCommerceapi-1.0.0 core/spec/controllers/admin/orders_controller_spec.rb
MyCommerce-0.0.3 core/spec/controllers/admin/orders_controller_spec.rb