smartdown icon indicating copy to clipboard operation
smartdown copied to clipboard

Add has content node to scenario api.

Open BenJanecke opened this issue 9 years ago • 2 comments

This will be used to assert against content in a outcome.

Usage

# Description
- name_of_q1_p1: answer_to_q1_p1
- name_of_q1_p2: answer_to_q1_p2
  name_of_q2_p2: answer_to_q2_p2
outcome_the_result
has content: "Some content", "Some more content"

BenJanecke avatar May 01 '15 12:05 BenJanecke

I might be missing something, but it feels odd to me that we're using so much regular expression and String manipulation in the ScenarioSetInterpreter rather than using Parslet rules. This isn't specific to this PR, so shouldn't necessarily prevent this from being merged, but I would like to understand why we're taking this approach.

Stepping back even further, I do worry that we're having to reinvent a lot of wheels in Smartdown - taking this PR as an example, Ruby already does a good job of interpreting an array of strings in various forms.

floehopper avatar May 05 '15 12:05 floehopper

The use of regex in ScenarioSetInterpreter was down to time pressures, and that the complexity of scenarios has grown since the initial implementation. I'd be happy to see it implemented with Parslet, when time allows.

Not using Ruby is the point of Smartdown, hence having to re-invent some wheels. As i explained, the two aims of Smartdown where:

  1. a syntax that mirrored how content designers think/interact with content, as they're the ultimate owners of smart-answers, not developers
  2. a safe representation that can be authored by non-developrs, be exposed via an API (to match the new-world GOV.UK publishing stack), and executed safely and securely.

Hopefully thats clearer?

dsingleton avatar May 06 '15 09:05 dsingleton