Created
January 8, 2013 19:59
-
-
Save Sephi-Chan/4487364 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BuyWeaponTest < ActiveSupport::TestCase | |
test "User buys a weapon" do | |
mp5 = WeaponType.create('mp5', gold: 40) | |
ak47 = WeaponType.create('ak47', gold: 100) | |
argo = User.create(name: 'Argo', gold: 100) | |
argo_mp5 = Weapon.create(weapon_type: mp5, user: argo) | |
UserBuysWeapon.new(user, ak47).perform! | |
assert_equal ak47, argo.weapon.weapon_type, "User's new weapon should be a AK-47" | |
assert_equal 20, argo.gold, 'User should be granted 50% of his current MP5' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment