Skip to content

Commit

Permalink
Merge pull request #244 from dg-ratiodata/feature/rspec_integration
Browse files Browse the repository at this point in the history
Add rspec integrator
  • Loading branch information
mattwynne committed May 7, 2015
2 parents f56f33d + 055ec68 commit 6410193
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 6410193

Please sign in to comment.