From 07b959090aad1a1f725df92db922acca36715efa Mon Sep 17 00:00:00 2001 From: Justin Ko Date: Mon, 24 Oct 2011 11:38:23 -0600 Subject: [PATCH 1/4] Add .rspec options file with "--color" and "--default_path spec". "default_path" allows you to run just "rspec" instead of "rspec spec". --- .rspec | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .rspec diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..53c8688 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color +--default_path spec From 6a595ab20f9d3c3ce66769097cc2d5a0c31ba4b0 Mon Sep 17 00:00:00 2001 From: Justin Ko Date: Mon, 24 Oct 2011 11:48:53 -0600 Subject: [PATCH 2/4] Move spec/samples to spec/support/samples --- spec/spec_helper.rb | 6 ++---- spec/{ => support}/samples/active_record.rb | 0 spec/{ => support}/samples/application_controller.rb | 0 spec/{ => support}/samples/application_helper.rb | 0 spec/{ => support}/samples/decorator.rb | 0 spec/{ => support}/samples/decorator_with_allows.rb | 0 .../samples/decorator_with_application_helper.rb | 0 spec/{ => support}/samples/decorator_with_denies.rb | 0 spec/{ => support}/samples/product.rb | 0 spec/{ => support}/samples/product_decorator.rb | 0 10 files changed, 2 insertions(+), 4 deletions(-) rename spec/{ => support}/samples/active_record.rb (100%) rename spec/{ => support}/samples/application_controller.rb (100%) rename spec/{ => support}/samples/application_helper.rb (100%) rename spec/{ => support}/samples/decorator.rb (100%) rename spec/{ => support}/samples/decorator_with_allows.rb (100%) rename spec/{ => support}/samples/decorator_with_application_helper.rb (100%) rename spec/{ => support}/samples/decorator_with_denies.rb (100%) rename spec/{ => support}/samples/product.rb (100%) rename spec/{ => support}/samples/product_decorator.rb (100%) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 28d7235..27e57e7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,5 @@ require 'rubygems' require 'bundler/setup' Bundler.require -require './spec/samples/application_helper.rb' -Dir.glob(['./spec/samples/*.rb', './spec/support/*.rb']) do |file| - require file -end + +Dir['./spec/support/**/*.rb'].each {|file| require file } diff --git a/spec/samples/active_record.rb b/spec/support/samples/active_record.rb similarity index 100% rename from spec/samples/active_record.rb rename to spec/support/samples/active_record.rb diff --git a/spec/samples/application_controller.rb b/spec/support/samples/application_controller.rb similarity index 100% rename from spec/samples/application_controller.rb rename to spec/support/samples/application_controller.rb diff --git a/spec/samples/application_helper.rb b/spec/support/samples/application_helper.rb similarity index 100% rename from spec/samples/application_helper.rb rename to spec/support/samples/application_helper.rb diff --git a/spec/samples/decorator.rb b/spec/support/samples/decorator.rb similarity index 100% rename from spec/samples/decorator.rb rename to spec/support/samples/decorator.rb diff --git a/spec/samples/decorator_with_allows.rb b/spec/support/samples/decorator_with_allows.rb similarity index 100% rename from spec/samples/decorator_with_allows.rb rename to spec/support/samples/decorator_with_allows.rb diff --git a/spec/samples/decorator_with_application_helper.rb b/spec/support/samples/decorator_with_application_helper.rb similarity index 100% rename from spec/samples/decorator_with_application_helper.rb rename to spec/support/samples/decorator_with_application_helper.rb diff --git a/spec/samples/decorator_with_denies.rb b/spec/support/samples/decorator_with_denies.rb similarity index 100% rename from spec/samples/decorator_with_denies.rb rename to spec/support/samples/decorator_with_denies.rb diff --git a/spec/samples/product.rb b/spec/support/samples/product.rb similarity index 100% rename from spec/samples/product.rb rename to spec/support/samples/product.rb diff --git a/spec/samples/product_decorator.rb b/spec/support/samples/product_decorator.rb similarity index 100% rename from spec/samples/product_decorator.rb rename to spec/support/samples/product_decorator.rb From dfd7cd456bdbfc04b8c0ac81fa1f983250540066 Mon Sep 17 00:00:00 2001 From: Justin Ko Date: Mon, 24 Oct 2011 11:49:37 -0600 Subject: [PATCH 3/4] Move require to file that needs it. --- spec/support/samples/application_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/support/samples/application_controller.rb b/spec/support/samples/application_controller.rb index 006ca35..614096a 100644 --- a/spec/support/samples/application_controller.rb +++ b/spec/support/samples/application_controller.rb @@ -1,3 +1,5 @@ +require './spec/support/samples/application_helper' + module ActionController class Base @@before_filters = [] @@ -29,4 +31,4 @@ class ApplicationController < ActionController::Base end end -Draper::System.setup \ No newline at end of file +Draper::System.setup From c1ff7a4f1af8acf61b6ad29496e823667a329748 Mon Sep 17 00:00:00 2001 From: Justin Ko Date: Mon, 24 Oct 2011 11:52:28 -0600 Subject: [PATCH 4/4] Keep lib spec files in draper directory. Remove unneeded require's. --- spec/{ => draper}/base_spec.rb | 1 - spec/{ => draper}/view_context_spec.rb | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) rename spec/{ => draper}/base_spec.rb (99%) rename spec/{ => draper}/view_context_spec.rb (97%) diff --git a/spec/base_spec.rb b/spec/draper/base_spec.rb similarity index 99% rename from spec/base_spec.rb rename to spec/draper/base_spec.rb index 23b7fe8..ddee45d 100644 --- a/spec/base_spec.rb +++ b/spec/draper/base_spec.rb @@ -1,5 +1,4 @@ require 'spec_helper' -require 'draper' describe Draper::Base do before(:each){ ApplicationController.new.set_current_view_context } diff --git a/spec/view_context_spec.rb b/spec/draper/view_context_spec.rb similarity index 97% rename from spec/view_context_spec.rb rename to spec/draper/view_context_spec.rb index cbc6ff1..bce6e3f 100644 --- a/spec/view_context_spec.rb +++ b/spec/draper/view_context_spec.rb @@ -1,5 +1,4 @@ require 'spec_helper' -require 'draper' describe Draper::ViewContext do let (:app_controller) do @@ -22,4 +21,4 @@ describe Draper::ViewContext do Thread.current[:current_view_context] = nil expect {app_controller.current_view_context}.should raise_exception(Exception) end -end \ No newline at end of file +end