serverspec/serverspec — pull request #371 by yujinakayama (2014-03-17 15:31:51+00:00)
Title: Handle rspec-its with RSpec 3

Related to #370.

To use the `its(:attr) { }` syntax with RSpec 3, installation of `rspec-its` gem and `require 'rspec/its'` is required. However, serverspec itself cannot require `rspec-its` and it needs to be done in users' `spec_helper.rb` for the following reasons:

* `rspec-its` gem has [rspec >= 2.99.0.beta1 dependency](https://github.com/rspec/rspec-its/blob/v1.0.0/rspec-its.gemspec#L21-L22).
* Serverspec still needs to support RSpec 2.

So I made `serverspec-init` add `require 'rspec/its'` to `spec_helper.rb` and suggest installation of `rspec-its` only when RSpec 3 is installed:

```
$ serverspec-init
Select OS type:

1) UN*X
2) Windows

Select number: 1

Select a backend type:

1) SSH
2) Exec (local)

Select number: 2

+ spec/
+ spec/localhost/
+ spec/localhost/httpd_spec.rb
+ spec/spec_helper.rb
+ Rakefile

To use the `its(:attr) { }` syntax with RSpec 3, you need to install rspec-its gem.
```

I'm still not sure if this is the best way. Also, I'm wondering whether `serverspec-init` should generate `Gemfile`.

What do you think?