-
-
Notifications
You must be signed in to change notification settings - Fork 38
Introduce names for FiniteMachine instances #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| after { FiniteMachine.logger = ::Logger.new($stderr) } | ||
|
|
||
| it "logs transitions" do | ||
| fsm = FiniteMachine.new log_transitions: true do | ||
| fsm = FiniteMachine.new name: "TrafficLights", log_transitions: true do | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need a test case when the name is not specified. I'd probably keep this test as it was without the name and test the short UUID generation. Let me know if you need any pointers on how to test this.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Understood. I'll give it a shot and reach out if I run into trouble. Thanks.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @piotrmurach: Just wanted to chime in and let you know that I got distracted but will get back to this in the next couple of days. Thanks. |
||
| initial :green | ||
|
|
||
| event :slow, :green => :yellow | ||
|
|
@@ -15,10 +15,10 @@ | |
|
|
||
| fsm.slow | ||
| output.rewind | ||
| expect(output.read).to match(/Transition: @event=slow green -> yellow/) | ||
| expect(output.read).to match(/Transition: @machine=TrafficLights @event=slow green -> yellow/) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [98/80] |
||
|
|
||
| fsm.stop(1, 2) | ||
| output.rewind | ||
| expect(output.read).to match(/Transition: @event=stop @with=\[1,2\] yellow -> red/) | ||
| expect(output.read).to match(/Transition: @machine=TrafficLights @event=stop @with=\[1,2\] yellow -> red/) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [110/80] |
||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,8 +29,8 @@ | |
| end | ||
|
|
||
| it "reports transition" do | ||
| logger.report_transition(:go, :red, :green) | ||
| logger.report_transition('TrafficLights', :go, :red, :green) | ||
|
raw-bin marked this conversation as resolved.
|
||
|
|
||
| expect(log).to have_received(:info).with("Transition: @event=go red -> green") | ||
| expect(log).to have_received(:info).with("Transition: @machine=TrafficLights @event=go red -> green") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [105/80] |
||
| end | ||
| end | ||
Uh oh!
There was an error while loading. Please reload this page.