-
Notifications
You must be signed in to change notification settings - Fork 2
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
Exception when running test suite (3.3.1) – build_scoped_id_for': undefined method
call' for :method:Symbol
#1
Comments
The offending method seems to be this: # spryte/lib/spryte/rspec/macros.rb
def method(verb)
let(:method) { verb.to_sym }
end Presumably |
I strongly suspect that the issue relates to this: # lib/rspec/core/example_group.rb
@metadata = Metadata::ExampleGroupHash.create(
superclass_metadata, user_metadata,
superclass.method(:next_runnable_index_for),
description, *args, &example_group_block
) So this is a nameclash between I guess one solution would be to change the Spryte DSL to use As an intermediate/additional step, it might also make sense to only accept a whitelisted set of verbs, and raise an exception if anything else is passed. @zeeraw thoughts on how to proceed? |
@dgmstuart I'm very much in favour of using something else since the clash is with ruby core. Referring to it as describe "list the toys" do
verb :get
path "/api/toys"
end I think describe "insert a mug in to the cupboard" do
http_method :post
path "/kitchen/cupboard/2/mugs"
end My suggestion would be to use something along the lines of describe "move king to D3" do
path "/chess/board/D/3"
through :put
end What are your thoughts? |
Noted. I think any word is going to be some sort of compromise, since
Any way it could clash with shoulda-matchers? it { should have_many(:projects).through(:clients) } |
@dgmstuart Not really, since the shoulda-matchers describe "thing" do
# here lives spryte
it { expect(true).to # here lives shoulda-matchers }
end |
As explained in #1 by @dgmstuart, the `#method` in spryte has a nameclash with `Object#method`. Chose to name it to `#through` rather than `#http_method` or `#verb` since it's a semantically intuitive DSL. Made sure that we output a deprecation warning pointing users to the new method and that the test suite will fail once we upgrade major version without removing the deprecated method.
Released 📦 v0.1.0 Thanks for your contributions @dgmstuart, much appreciated! |
This error happens on RSpec 3.3.1 and above when trying to run any spec (not just those which use the spryte dsl). Full trace: rspec/rspec-core#2008
The inclusion which causes the errors is:
(
config.include Spryte::RSpec::Helpers
seems to be fine)With this in the
rails_helper
a spec comprising one emptyit
block is sufficient to throw the error.The text was updated successfully, but these errors were encountered: