Sha256: 4844619876fe401353b7debcba67c64d9b6aaaa452186196895d6819e46c8e34

Contents?: true

Size: 440 Bytes

Versions: 4

Compression:

Stored size: 440 Bytes

Contents

require 'spec'

class Calculadora
  def push(n)
    @args ||= []
    @args << n
  end
  
  def soma
    @args.inject(0) {|n,sum| sum+n}
  end
end

Before do
  @calc = Calculadora.new
end

After do
end

Given /que eu digitei (\d+) na calculadora/ do |n|
  @calc.push n.to_i
end

When 'eu aperto o botão de soma' do
  @result = @calc.soma
end

Then /o resultado na calculadora deve ser (\d*)/ do |result|
  @result.should == result.to_i
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
elight-cucumber-0.1.9 examples/portuguese_calculator/features/calculadora_steps.rb
cucumber-0.1.8 examples/portuguese_calculator/features/calculadora_steps.rb
cucumber-0.1.7 examples/portuguese_calculator/features/calculadora_steps.rb
cucumber-0.1.6 examples/portuguese_calculator/features/calculadora_steps.rb