diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..4e1e0d2 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--color 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 57ece17..9877b15 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 62% rename from spec/view_context_spec.rb rename to spec/draper/view_context_spec.rb index a692215..db94073 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,14 +21,4 @@ describe Draper::ViewContext do Draper::ViewContext.current = nil expect {app_controller.current_view_context}.should raise_exception(Exception) end - - it "sets view_context every time" do - app_controller_instance.stub(:view_context) { 'first' } - app_controller_instance.set_current_view_context - Draper::ViewContext.current.should == 'first' - - app_controller_instance.stub(:view_context) { 'second' } - app_controller_instance.set_current_view_context - Draper::ViewContext.current.should == 'second' - end -end \ No newline at end of file +end 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 88% rename from spec/samples/application_controller.rb rename to spec/support/samples/application_controller.rb index 006ca35..614096a 100644 --- a/spec/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 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