Sha256: 18bceede7268a8efc1cbde1ec4ba66c01e04a6bcd351acd99ccf35d540b5e247

Contents?: true

Size: 934 Bytes

Versions: 1

Compression:

Stored size: 934 Bytes

Contents

require 'spec_helper'

describe Rtml::Test::SimulatorPostProcessors::Submit do
  def tml
  <<-end_tml
    <tml>
      <screen id='setup'>
        <setvar name="payment.amount" lo="100" />
      </screen>

      <screen id='do_submit'>
        <submit tgt='test_location'>
          <getvar name='payment.amount' />
        </submit>
      </screen>
    </tml>
  end_tml
  end

  def mock_response
    resp = Rack::Response.new
    resp.body = "<tml><screen/></tml>"
    resp
  end

  subject do
    Rtml::Test::Simulator.new()
  end

  before(:each) do
    subject.load_tml! tml
  end

  it "should have payment amount assigned" do
    subject.variables['payment.amount'].should == 100
  end

  it "should dispatch a request" do
    subject.should_receive(:response).at_least(1).and_return(mock_response)
    subject.should_receive(:post).with("test_location", {'payment.amount' => 100}, {})

    subject.visit "#do_submit"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtml-2.0.4 spec/widgets/simulator_post_processors/submit_spec.rb