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

Fixture YML using several time the same {@ref} #1004

Open
Ashk2a opened this issue Oct 17, 2019 · 3 comments
Open

Fixture YML using several time the same {@ref} #1004

Ashk2a opened this issue Oct 17, 2019 · 3 comments
Labels
Milestone

Comments

@Ashk2a
Copy link

Ashk2a commented Oct 17, 2019

Hi, in this example we have :

event_1:
  id: 1
  name: "event 1"
event_2:
  id: 2
  name: "event_2"

When I try this, only one record is register inside the database (I use SQLite)

something_{@event_1}:
  id: 1
  event: <current()>
something_{@event_1}_test:
  id: 2
  event: <current()>

But it's working when this :

something_{@event_1}:
  id: 1
  event: <current()>
something_event_1_test:
  id: 2
  event: '@event_1'

Something is wrong with my usage ?

@theofidry
Copy link
Member

I'm not quite sure <current> refers to @event_1 or the string '@event_1' in this case... I think it should refer to the fixture instance though. So your usage should work just fine, meaning this is a bug.

@theofidry theofidry added the Bug label Oct 18, 2019
@theofidry theofidry added this to the 3.x milestone Oct 18, 2019
@Ashk2a
Copy link
Author

Ashk2a commented Oct 18, 2019

When we have something_{@event_1} <current()> is the same thing than '@event_1'
Like if we have something_event_{1} with '@event$current'_ (or '@event<current()>_, both work i guess) it's again the same thing. BUT i can't use several time {@event_1} in the same call

@mac503
Copy link

mac503 commented Jun 25, 2020

I'm experiencing something similar.

Given that these fixtures exist:

fixture_1:
    id: 1
fixture_2:
    id: 2
...etc

Then when those fixtures are used in two sets of later fixtures, like this, only the second set is created:

group_{@fixture*}:
    fixture: <current()>
    property: <getValue()>
group_{@fixture*}_alternative:
    fixture: <current()>
    property: <getAlternativeValue()>

In fact, the custom provider function getValue(), used in the first set, is never called.

However, just by changing the beginning of the name for the second set of fixtures, instead of the end of the name, this works:

group_{@fixture*}:
    fixture: <current()>
    property: <getValue()>
alternate_group_{@fixture*}:
    fixture: <current()>
    property: <getAlternativeValue()>

Both sets are created correctly.

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

No branches or pull requests

3 participants