Sha256: 45401b2d1a125ed9b8b457e8a25473558ee9a7fd4ff805faed0c324fc7246c96
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
require 'spec_helper' CLI_MATCHERS = [ /^Obtaining latest/, /Parsing values/, /^Done: \d+/ ] values = %q{\d+\.\d+\s+\/\s+\d+\.\d+} start = '- ' OUTPUT_MATCHERS = [ /^#{start}Dollar Official.*#{values}$/, /^#{start}Dollar Card.*n\/a\s+\/\s+\d+\.\d+$/, /^#{start}Dollar Blue.*#{values}$/, /^#{start}Gap card/, /^#{start}Gap official/, /^Information source:$/ ] describe Dolarblue do before(:each) do # Save and capture standard output @saved_stdout = $stdout $stdout = StringIO.new end after(:each) do # Restore standard output $stdout = @saved_stdout end context 'CLI' do let(:path) { File.expand_path('../../bin/dolarblue', __FILE__) } it 'should print out status information about querying base_url and parsing data' do (CLI_MATCHERS).each do |regex| $stdout.should_receive(:print).with(regex) end load path end it 'should puts all the dollar exchange values' do load path (OUTPUT_MATCHERS).each do |regex| expect($stdout.string).to match(regex) end end end context 'Class Methods' do subject { Dolarblue } it 'should return all the dollar exchange Blue/Official/Card values and percentiles' do OUTPUT_MATCHERS.each do |regex| expect(subject.get_output).to match(regex) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dolarblue-0.5.1 | spec/dolarblue_spec.rb |
dolarblue-0.5.0 | spec/dolarblue_spec.rb |