Skip to content

Commit

Permalink
Add RSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalo-bulnes committed Feb 26, 2015
1 parent 9673438 commit 1663ad5
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .rspec
@@ -0,0 +1,4 @@
--format documentation
--color
--order rand

17 changes: 17 additions & 0 deletions Gemfile.lock
Expand Up @@ -2,13 +2,30 @@ PATH
remote: .
specs:
dredd-rack (0.1.0)
rake (~> 10.4)

GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.2.5)
rake (10.4.2)
rspec (3.2.0)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.0)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.1)

PLATFORMS
ruby

DEPENDENCIES
dredd-rack!
rspec (~> 3.0)
29 changes: 29 additions & 0 deletions Rakefile
@@ -0,0 +1,29 @@
require 'rspec/core/rake_task'

begin
require 'rspec/core/rake_task'

desc 'Provide private interfaces documentation'
RSpec::Core::RakeTask.new(:spec)

namespace :spec do
desc 'Provide public interfaces documentation'
RSpec::Core::RakeTask.new(:public) do |t|
t.rspec_opts = "--tag public"
end
end

namespace :spec do
desc 'Provide private interfaces documentation for development purpose'
RSpec::Core::RakeTask.new(:development) do |t|
t.rspec_opts = "--tag protected --tag private"
end
end
rescue LoadError
desc 'RSpec rake task not available'
task :spec do
abort 'RSpec rake task is not available. Be sure to install rspec-core as a gem or plugin'
end
end

task :default => ['spec:public', 'spec:development']
5 changes: 5 additions & 0 deletions dredd-rack.gemspec
Expand Up @@ -14,4 +14,9 @@ Gem::Specification.new do |gem|
gem.license = "GPLv3"

gem.files = Dir["{doc,lib}/**/*", "Gemfile", "LICENSE", "Rakefile", "README.md"]
gem.test_files = Dir["spec/**/*"]

gem.add_dependency "rake", "~> 10.4"

gem.add_development_dependency "rspec", "~> 3.0"
end
2 changes: 1 addition & 1 deletion lib/dredd/rack.rb
@@ -1 +1 @@
require 'rack/version'
require 'dredd/rack/version'
35 changes: 35 additions & 0 deletions spec/spec_helper.rb
@@ -0,0 +1,35 @@
require 'bundler/setup'
Bundler.setup

require 'dredd/rack'

Dir["./spec/support/**/*.rb"].sort.each { |f| require f; puts f }

# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# make sure the deprecated RSpec 2 syntax is not used
config.raise_errors_for_deprecations!

# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end

# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end
end
Empty file added spec/support/.keep
Empty file.

0 comments on commit 1663ad5

Please sign in to comment.