Sha256: e06275ba5fd7b098c22f11882c74a3c58f1a2caf2816d5bc154df3167eeb3730

Contents?: true

Size: 410 Bytes

Versions: 2

Compression:

Stored size: 410 Bytes

Contents

steps_for :knight do
  attr_accessor :knight

  class Knight
    def initialize
      @hp = 20
    end

    def alive?
      @hp > 0
    end

    def attacked_for(amount)
      @hp -= amount
    end
  end

  step "there is a knight" do
    self.knight = Knight.new
  end

  step "the knight is alive" do
    knight.should be_alive
  end

  step "the knight is dead" do
    knight.should_not be_alive
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
turnip-0.3.1 examples/knight_steps.rb
turnip-0.3.0 examples/knight_steps.rb