Sha256: 6fc4175b582ad533838013e17df74477a345c57e4b29d4edd08a41b9290b1304

Contents?: true

Size: 681 Bytes

Versions: 2

Compression:

Stored size: 681 Bytes

Contents

require 'spec_helper'

describe Amida::Prize do
  context 'width == 5' do
    let(:prize) { Amida::Prize.new(5) }
    let(:correct_result) { "    \e[33m!!!\e[0m            " }

    describe '#to_s' do
      context 'when prize index == 1' do
        before do
          Amida::Prize.any_instance.stub(:random_index).and_return(1)
        end

        it { prize.send(:to_s).should == correct_result }
      end
    end

    describe '#render' do
      context 'when prize index == 1' do
        before do
          prize.stub(:to_s).and_return(correct_result)
        end

        it { capture(:stdout){ prize.render }.should == correct_result + "\n" }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
amida-0.0.4 spec/amida/prize_spec.rb
amida-0.0.3 spec/amida/prize_spec.rb