require 'spec_helper'
describe Rtml::Test::SimulatorPostProcessors::CardParsers do
def tml_for(parser, params)
<<-end_tml
#{setup_tml_for(parser)}
#{setup_tml_for(parser)}
done
end_tml
end
def setup_tml_for(parser)
case parser.to_s
when 'mag'
<<-end_tml
end_tml
else raise 'no setup code for '+parser.to_s
end
end
subject do
Rtml::Test::Simulator.new
end
context "with a 'mag' parser" do
context "and 'risk_mgmt' params" do
before(:each) do
subject.load_tml! tml_for("mag", "risk_mgmt")
end
it "should set 'card.parser.verdict' to 'online'" do
subject.swipe_card(:visa)
subject.variables['card.parser.verdict'].should == 'online'
end
it "should move to the next screen" do
subject.swipe_card(:visa)
subject.current_screen_id.should_not == "first"
subject.current_screen_id.should_not be_nil
end
context "given a next element with false variants" do
it "should follow the next uri" do
subject.visit("#alt_first")
subject.current_screen_id.should == "alt_first"
subject.swipe_card(:visa)
subject.current_screen_id.should_not == "first"
subject.current_screen_id.should_not be_nil
end
end
end
end
it "with an 'emv' reader"
end