summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/ptu_pokemons.yml23
-rw-r--r--test/models/ptu_pokemon_test.rb14
2 files changed, 37 insertions, 0 deletions
diff --git a/test/fixtures/ptu_pokemons.yml b/test/fixtures/ptu_pokemons.yml
new file mode 100644
index 0000000..6c0db12
--- /dev/null
+++ b/test/fixtures/ptu_pokemons.yml
@@ -0,0 +1,23 @@
+# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ name: Bulbasaur
+ base_hp: 5
+ base_atk: 5
+ base_def: 5
+ base_spatk: 7
+ base_spdef: 7
+ base_speed: 5
+ male_chance: 87.5
+ notes: Some info
+
+two:
+ name: Charmander
+ base_hp: 4
+ base_atk: 5
+ base_def: 4
+ base_spatk: 6
+ base_spdef: 5
+ base_speed: 7
+ male_chance: 87.5
+ notes: Blah blah
diff --git a/test/models/ptu_pokemon_test.rb b/test/models/ptu_pokemon_test.rb
new file mode 100644
index 0000000..0b4aa2f
--- /dev/null
+++ b/test/models/ptu_pokemon_test.rb
@@ -0,0 +1,14 @@
+require "test_helper"
+
+class PtuPokemonTest < ActiveSupport::TestCase
+ test "can create" do
+ assert_difference("PtuPokemon.count", 1) do
+ PtuPokemon.create(name: "SomeMon", base_hp: 1, base_atk: 2, base_def: 3, base_spatk: 4, base_spdef: 5,
+ base_speed: 6)
+ end
+ end
+
+ test "can't set a male chance greater than 100" do
+ assert_not ptu_pokemons(:one).update(male_chance: 150.20)
+ end
+end