开发者

What's a good tutorial for creating a gem with RSpec? [closed]

开发者 https://www.devze.com 2022-12-24 16:32 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 9 years ago.

Improve this question

I've been searching around for ways to create a gem with RSpec, but haven't found descriptive tutorials.

I started out with Ryan Bates' Making a gem, but I'm looking for a tutorial that discusses creating an acts_as style gem with RSpec.

开发者_开发知识库

By acts_as, I mean to say that the gem adds certain methods to an existing class in Rails. Why is this important? Because I've found gem templates like New Gem, got a spec to run but when I try to test an Active Record object it starts choking. I've tried requiring active_record in spec_helper.rb but I must be doing something wrong because it doesn't solve the problem.

When it comes to plugins, I found this Rails Guide. If there's a gem version for that around that'd be awesome.

Thanks guys!

P.S. I love screencasts.


I like using jeweler for starting gems.

to generate a gem skeleton with rspec

jeweler --rspec my-gem-with-rspec


This question should have an answer about Bundler.

As much as I know, Bundler is -maybe- the most popular and used tool for easily creating gem skeletons.

And here is a great tutorial about it:

http://rakeroutes.com/blog/lets-write-a-gem-part-one/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号