Gemstone controllers with RSpec

I wonder how to test controllers outside the rails - in a new gem.

How to simulate them and how to use Rails controller test assistants, such as get, post?

I am trying to test before_filterwhich is executed from a developed module.

+5
source share
1 answer

It has a good tutorial here . But basically what you need to do is:

  • Install the RSpec gem with gem install rspec
  • Be sure to maintain the correct folder structure, your specification should go into the specification folder
  • spec_helper.rb spec , , , : require_relative "../filename"
  • _spec.rb spec_helper: require "spec_helper"
  • , spec_helper.rb, expect, , gem install rspec-expectations
  • , rspec-mocks gem install rspec-mocks

, , .

, . !

+1

All Articles