Skip to content

Instantly share code, notes, and snippets.

@dlupu
Created December 30, 2019 18:51
Show Gist options
  • Save dlupu/c1d341ffba06d08d5699d82832d29af8 to your computer and use it in GitHub Desktop.
Save dlupu/c1d341ffba06d08d5699d82832d29af8 to your computer and use it in GitHub Desktop.
Create rspec rails plugin
# http://stackoverflow.com/questions/8507798/rails-3-1-plugin-gem-dummy-test-app-rspec
# http://namick.tumblr.com/post/17663752365/how-to-create-a-gemified-plugin-with-rails-3-2-rspec
rails plugin new plugin_name --skip-test-unit --dummy-path=spec/dummy
cd plugin_name
# Add rspec-rails to gemspec dev deps
# s.add_development_dependency "rspec-rails"
bundle install
cd spec/dummy
ln -s ../../spec
rails generate rspec:install
cd -
# Edit spec/spec_helper.rb or spec/rails_helper.rb (depends) and change
# require File.expand_path("../../config/environment", __FILE__)
# to
# require File.expand_path("../dummy/config/environment", __FILE__)
# Check if it works
rspec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment