Skip to content

Commit

Permalink
add invalid state error spec
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainFranceschini committed Apr 24, 2020
1 parent 9b61fe1 commit 74a546b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion spec/state_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describe "Stateful" do
end

context "inheritance" do
it do
it "" do
m = Point2d.new
m.x.should eq 0
m.y.should eq 0
Expand All @@ -186,6 +186,24 @@ describe "Stateful" do
s.y.should eq 1
end

it "raises if child is given parent state" do
m = Point2d.new
expect_raises(InvalidStateError) do
m.state = Quartz::State.new
end
expect_raises(InvalidStateError) do
m.initial_state = Quartz::State.new
end

m = Point3d.new
expect_raises(InvalidStateError) do
m.state = Point2d::State.new
end
expect_raises(InvalidStateError) do
m.initial_state = Point2d::State.new
end
end

it "subclasses inherits state of parents" do
m = Point3d.new
m.x.should eq 0
Expand Down

0 comments on commit 74a546b

Please sign in to comment.