Skip to content
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

Does not respond to field other than state #3

Open
supertracer opened this issue Mar 4, 2017 · 2 comments
Open

Does not respond to field other than state #3

supertracer opened this issue Mar 4, 2017 · 2 comments

Comments

@supertracer
Copy link

I am using a field current_state instead of traditional state field for state machine

field :current_state, type: String
state_machine :current_state, :initial => :scheduled do
    event :patient_arrived do
      transition :scheduled => :waiting
    end
    event :patient_engaged do
      transition :waiting => :engaged
    end
    event :patient_seen do
      transition [:scheduled, :waiting, :engaged] => :seen
    end
    event :undo_arrived do
      transition :waiting => :scheduled
    end
  end

It is throwing error
Failure/Error: it { should have_states :scheduled, :waiting, :engaged, :seen }
Expected state to allow states: scheduled, waiting, engaged, seen

However if i change my field from 'current_state' to 'state' my test case passes.
I could not find any documentation to handle this, is this an issue or is there some workaround

@vtm9
Copy link
Contributor

vtm9 commented May 5, 2017

@supertracer, You should pass the state name:
it { should have_states :scheduled, :waiting, :engaged, :seen, on: :current_state }

@vtm9
Copy link
Contributor

vtm9 commented Jul 28, 2017

@seuros maybe close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants