Avinash,
Glad to hear you like RSpec. Setting up a gem project is fairly similar.
Just start your gem, add rspec as a development dependency and run the
rspec setup: rspec --init. That will create the .rspec and
spec/spec_helper.rb files for you. After that it’s just as normal. The
folder structure is up to you. In general, my suggestion is to mirror your
lib directory. This is in the rspec-rails docs, though it probably can be
added to the main rspec docs too. I’ve copied and adjusted the doc to
remove the rails-y part:
It is suggested that the spec/ directory structure generally mirror both
app/ and lib/. This makes it easy to locate corresponding code and spec
files.
*Example:*
lib
├── country_map
│ ├── city.rb
│ └── state.rb
├── country_map.rb
└── tasks
├── irc.rake
spec
├── country_map
│ ├── city_spec.rb
│ └── state_spec.rb
├── country_map_spec.rb
├── spec_helper.rb
├── support
│ ├── allow_remote_requests.rb
│ ├── custom_matchers.rb
└── tasks
├── irc_spec.rb
Happy specing
On Thu, Sep 18, 2014 at 8:08 AM, Venkata Avinash Duggirala <
[email protected]> wrote:
> Hi,
>
> I need to do UNIT Testing to a gem which is in development. I want to use
> RSPEC framework. I am well versed in using RSPEC framework to automate web
> application.
>
> But, I never created a project to do unit testing a gem. Can anyone
> provide me how to start up, setting up the project, how folder structure
> should.
>
> Awaiting reply.
>
> Regards,
> Avinash Duggirala
>
> --
> You received this message because you are subscribed to the Google Groups
> "rspec" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rspec/8271cc91-6d84-458e-8329-e2416dd61c86%40googlegroups.com
> <https://groups.google.com/d/msgid/rspec/8271cc91-6d84-458e-8329-e2416dd61c86%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/CAKCESdj_iQKizbbED3H%2Bvzp_zgRwuWWPqEZjvw9XO6nApWfOcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.