From 00e4e4cc238b3651d67958f91818796b064c5fa7 Mon Sep 17 00:00:00 2001 From: Arian Weber Date: Fri, 26 Jan 2024 16:59:22 +0100 Subject: [PATCH] New integration test for shared variables --- .../ruby_dsl/009_shared_variables.rb | 26 +++++++++++++++++++ .../hash_transformation_spec.rb | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 integration_tests/ruby_dsl/009_shared_variables.rb diff --git a/integration_tests/ruby_dsl/009_shared_variables.rb b/integration_tests/ruby_dsl/009_shared_variables.rb new file mode 100644 index 0000000..1c2ab61 --- /dev/null +++ b/integration_tests/ruby_dsl/009_shared_variables.rb @@ -0,0 +1,26 @@ +model :TestAction do + + graph :Car do + var distance_to_wall: (0..10), init: 0 + + states :DrivingRelentlessly + + transition :DrivingRelentlessly => :DrivingRelentlessly do + precon "distance_to_wall > 0" + action "distance_to_wall := distance_to_wall - 1" + end + end + graph :CrashDetector do + states :no_crash, :crash, init: :no_crash + + transition :no_crash => :crash do + guard "distance_to_wall == 0" + end + + end + + specify "The car" do + it "starts out driving" => :"CrashDetector == no_crash && Car == DrivingRelentlessly" + it "crashes horribly" => :"F CrashDetector == crash" + end +end diff --git a/spec/lib/pg-tools/transformation/hash_transformation_spec.rb b/spec/lib/pg-tools/transformation/hash_transformation_spec.rb index d70ab2c..252893d 100644 --- a/spec/lib/pg-tools/transformation/hash_transformation_spec.rb +++ b/spec/lib/pg-tools/transformation/hash_transformation_spec.rb @@ -1,7 +1,7 @@ RSpec.describe PgTools::Transform::HashTransformation do - test_files = Dir[File.join(PgTools.root, "integration_tests", "ruby_dsl", "*.rb")] + test_files = Dir[File.join(PgTools.root, "integration_tests", "ruby_dsl", "*.rb")].sort test_files.each { |test_file| it "round trips for '#{File.basename(test_file)}'" do