agileanimal / grape-entity-matchers

Shoulda-style matchers to help with testing grape entities.
MIT License
58 stars 30 forks source link

undefined method `exposures' for Entity::Class #26

Open dzemlianoi-double opened 3 years ago

dzemlianoi-double commented 3 years ago

I have a problem with testing grape entities.

Error text: undefined method 'exposures' for ExampleEntity:Class. Did you mean? expose

Line: /Users/denyszemlianoi/.rvm/gems/ruby-2.7.2@test_project/gems/grape-entity-matchers-1.3.0/lib/grape_entity_matchers/represent_matcher.rb:65

Gemfile.lock

    grape-entity (0.8.2)
      activesupport (>= 3.0.0)
      multi_json (>= 1.3.2)
    grape-entity-matchers (1.3.0)
      grape-entity (>= 0.5.0)
      rspec (>= 3.2.0)

Code

require 'grape-entity-matchers'
RSpec.describe ExampleEntity do
  subject(:entity) { described_class }

  describe 'when fields are correct' do
    describe '#id' do
      it { is_expected.to represent(:id).with_documentation(type: String, required: false) }
    end
  end
end

Does anyone have any suggestions? Maybe it depends on too high version of grape-entity?

jefawks3 commented 2 years ago

I was having the same issues, and, from what I can tell, it does not look like this project is being maintained anymore. I just extracted the code I used and started the project rspec-grape-entity.

Edit: My project takes a different approach and is inspired by the rspec-its structure.