3

I have a blueprint:

Model.blueprint(:something) do
  name "Some name"
  context "some context"
end

"context" is an attribute of Model, but it is also a reserved word of RSpec. When I try to make and object I get ArgumentError on "context" line.

Any ideas how to overcome this situation?

Tomek Wałkuski
  • 989
  • 12
  • 22

1 Answers1

0

Unable to replicate this with Machinist 2.0.0.beta2.

Machinist works by overriding method_missing? and then assigning attributes based on those arguments. If rspec is somehow assigning a context method to Machinist's Lathe's objects, then that method will be called before method_missing?. If you're still experiencing this problem, you could try using remove_method :context before evaluating attributes:

Model.blueprint(:something) do
  remove_method :context
  name "Some name"
  context "some context"
  alias_method :context, :describe
end

I can't tell if that would work, as I can't replicate it locally, but I would give it a shot.

u2622
  • 2,991
  • 3
  • 25
  • 27