From 3d74934e031991e4e68d09cd2e18417907c5da5f Mon Sep 17 00:00:00 2001 From: Hernan Zalazar Date: Tue, 17 Mar 2015 15:57:25 -0300 Subject: [PATCH] Start adding integration tests. Added Guard. Removed unused deps. --- .rspec | 4 ++-- Guardfile | 6 +++++ Rakefile | 24 +++++++++++++++---- auth0.gemspec | 3 ++- .../lib/auth0/auth0_client_spec.rb | 4 ++++ spec/spec_helper.rb | 2 -- 6 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 Guardfile create mode 100644 spec/integration/lib/auth0/auth0_client_spec.rb diff --git a/.rspec b/.rspec index eef7b0fe..a6c7b731 100644 --- a/.rspec +++ b/.rspec @@ -1,3 +1,3 @@ --color ---format documentation ---fail-fast +--format Fuubar +--color \ No newline at end of file diff --git a/Guardfile b/Guardfile new file mode 100644 index 00000000..2662a582 --- /dev/null +++ b/Guardfile @@ -0,0 +1,6 @@ +guard 'rspec', cmd: 'rspec --drb --format Fuubar --color' do + # run every updated spec file + watch(%r{^spec/.+_spec\.rb$}) + # run the lib specs when a file in lib/ changes + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } +end \ No newline at end of file diff --git a/Rakefile b/Rakefile index 97862334..2098c1d3 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,23 @@ #!/usr/bin/env rake require "bundler/gem_tasks" -require 'rspec/core/rake_task' -desc "Run specs" -RSpec::Core::RakeTask.new +begin + require 'rspec/core/rake_task' -desc 'Run specs' -task :default => :spec \ No newline at end of file + desc "Run Integration Tests" + RSpec::Core::RakeTask.new(:integration) do |t| + t.pattern = FileList["spec/integration/**/*#{ENV['PATTERN']}*_spec.rb"] + end + + + desc "Run Unit Tests" + RSpec::Core::RakeTask.new(:spec) do |t| + t.pattern = FileList["spec/lib/auth0/**/*#{ENV['PATTERN']}*_spec.rb"] + end + + task :default => :spec + + task :all => [:spec, :integration] +rescue LoadError + #No RSpec +end \ No newline at end of file diff --git a/auth0.gemspec b/auth0.gemspec index f107e524..b92a8962 100644 --- a/auth0.gemspec +++ b/auth0.gemspec @@ -21,10 +21,11 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'httparty', '~> 0.13' s.add_development_dependency 'rake' + s.add_development_dependency 'fuubar' + s.add_development_dependency 'guard-rspec' s.add_development_dependency 'rspec', '~> 3.1.0', '>= 3.1.0' s.add_development_dependency 'rack-test' s.add_development_dependency 'simplecov' - s.add_development_dependency 'webmock' s.add_development_dependency 'byebug' s.add_development_dependency 'faker' s.add_development_dependency 'yard' diff --git a/spec/integration/lib/auth0/auth0_client_spec.rb b/spec/integration/lib/auth0/auth0_client_spec.rb new file mode 100644 index 00000000..c863706e --- /dev/null +++ b/spec/integration/lib/auth0/auth0_client_spec.rb @@ -0,0 +1,4 @@ +require "spec_helper" +describe Auth0Client do + it { expect { Auth0Client.new({}) }.to raise_error(SocketError) } +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0e4e2955..6c26ccc1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,13 +6,11 @@ end require 'rspec' require 'rack/test' -require 'webmock/rspec' require 'byebug' require 'auth0' Dir[("./lib/**/*.rb")].each { |f| require f } Dir[("./spec/support/**/*.rb")].each { |f| require f } RSpec.configure do |config| - config.include WebMock::API config.include Rack::Test::Methods # config.fail_fast = true end