cabbage-ex / cabbage

Story BDD tool for executing elixir in ExUnit
MIT License
138 stars 33 forks source link

Fix module attribute registration and support elixir 1.7 #50

Closed frahugo closed 5 years ago

frahugo commented 5 years ago

With Elixir 1.7, we get the following error when running the tests:

Compiling 4 files (.ex)

== Compilation error in file test/changing_names_test.exs ==
** (MissingStepError) Please add a matching step for:
"Given I am a User"

  defgiven ~r/^I am a User$/, _vars, state do
    # Your implementation here
  end

    (cabbage) lib/cabbage/feature.ex:235: Cabbage.Feature.compile/4
    (elixir) lib/enum.ex:1314: Enum."-map/2-lists^map/1-0-"/2
    (cabbage) lib/cabbage/feature.ex:192: anonymous fn/4 in Cabbage.Feature."MACRO-__before_compile__"/2
    (elixir) lib/enum.ex:1314: Enum."-map/2-lists^map/1-0-"/2
    (cabbage) expanding macro: Cabbage.Feature.__before_compile__/1
    test/changing_names_test.exs:1: Cabbage.ChangingNamesTest (module)
    (elixir) lib/code.ex:767: Code.require_file/2
    (elixir) lib/kernel/parallel_compiler.ex:209: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

erlang 21.0.4 elixir 1.7.1

The problem is due to changes to the way the module attributes are stored in ETS and the fact that the registration is not done upfront when calling use Cabbage.Feature.

Todo:

frahugo commented 5 years ago

Resolves #49

@kerryb can you please confirm that this branch solves the issue on your side? Thanks

kerryb commented 5 years ago

Yes, running @civilcode's branch fixes the issue. Thanks :-)

frahugo commented 5 years ago

@mgwidmann Hey Matt. When you have a minute, can you look at this PR and see if it can be merged? Could it be possible to be added as a maintainer? thanks.

maryolivier commented 5 years ago

^ bump @mgwidmann

vinceurag commented 5 years ago

^ @mgwidmann

nicholasjhenry commented 5 years ago

@vinceurag - @frahugo and I will do a peer review and get this merged today.

maryolivier commented 5 years ago

@nicholasjhenry thank you; excited for this

vinceurag commented 5 years ago

Nice! :trophy:

hisapy commented 5 years ago

Hey guys, can you please release this fix to hex? ... the last version out there is 0.3.5... thanks in advance

hisapy commented 5 years ago

Up to this day, the latest version on hex is 0.3.5, and it doesn't contain the fix in this PR... can any of the maintainers please release a new version with this fix?

nicholasjhenry commented 5 years ago

It is on my to-do list @hisapy. In the meantime, you can reference the github repo in your mix file.