Skip to content

Commit

Permalink
Add rspec integrator
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmeyer committed May 4, 2015
1 parent 9e98a56 commit 055ec68
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,23 @@ well. One might want to use it together with `rspec`.
1. Create a directory named `spec/support`
2. Create a file named `spec/support/aruba.rb` with:

```ruby
require 'aruba/rspec'
```
require 'aruba/api'
require 'aruba/reporting'
RSpec.configure do |config|
config.include Aruba::Api

config.before(:each) do
restore_env
clean_current_dir
end
end
```
3. Add the following to your `spec/spec_helper.rb`

```
```ruby
Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f }
```

4. Add a type to your specs

```ruby
RSpec.describe 'My feature', type: :aruba do
# [...]
end
```

## API

Expand Down
26 changes: 26 additions & 0 deletions lib/aruba/rspec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'rspec/core'
require 'aruba/api'
require 'aruba/reporting'

RSpec.configure do |config|
config.include Aruba::Api, type: :aruba

config.before :each do
next unless self.class.include?(Aruba::Api)

restore_env
clean_current_directory
end

# config.before do
# next unless self.class.include?(Aruba::Api)

# current_example = context.example

# announcer.activate(:environment) if current_example.metadata[:announce_env]
# announcer.activate(:command) if current_example.metadata[:announce_cmd]
# announcer.activate(:directory) if current_example.metadata[:announce_dir]
# announcer.activate(:stdout) if current_example.metadata[:announce_stdout]
# announcer.activate(:stderr) if current_example.metadata[:announce_stderr]
# end
end

0 comments on commit 055ec68

Please sign in to comment.