Skip to content

Commit

Permalink
add rspec-guard to run specs automatically (#163)
Browse files Browse the repository at this point in the history
* add rspec-guard

* update gruard dependency

* modify Guard file and rename category spec

* split index to many for guard to run properly

* change folder name

* improve coverage

* split wrapper spec files for guard to run

* add files

* organize plotting spec files

* update readme regarding testing with guard

* update contributing
  • Loading branch information
lokeshh authored and v0dro committed Aug 22, 2016
1 parent a3659e2 commit 034e4a9
Show file tree
Hide file tree
Showing 25 changed files with 1,144 additions and 1,110 deletions.
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ While preparing your pull requests, don't forget to check your code with Rubocop

`bundle exec rubocop`


## Testing

Daru has automatic testing with Guard. Just execute the following code before you start editting a file and any change you make will trigger the appropriate tests-

```
guard rspec
```

**NOTE**: Please make sure that you place test for your file at the same level and with same itermediatary directories. For example if code file lies in `lib/xyz/abc.rb` then its corresponding test should lie in `spec/xyz/abc_spec.rb`. This is to ensure correct working of Guard.

## Daru internals

To get an overview of certain internals of daru and their implementation, go over [this blog post](http://v0dro.github.io/blog/2015/08/16/elaboration-on-certain-internals-of-daru/).
7 changes: 7 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
guard :rspec, cmd: 'rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/daru/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end

# TODO: Run Rubocop in the background
3 changes: 3 additions & 0 deletions daru.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,7 @@ EOF
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'nokogiri'
spec.add_development_dependency 'gruff'
if RUBY_VERSION >= '2.2.5'
spec.add_development_dependency 'guard-rspec'
end
end
5 changes: 4 additions & 1 deletion lib/daru.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ def plotting_library= lib

require 'daru/version.rb'

require 'daru/index/index.rb'
require 'daru/index/multi_index.rb'
require 'daru/index/categorical_index.rb'

require 'daru/helpers/array.rb'
require 'daru/index.rb'
require 'daru/vector.rb'
require 'daru/dataframe.rb'
require 'daru/monkeys.rb'
Expand Down
Loading

0 comments on commit 034e4a9

Please sign in to comment.