Skip to content

Commit 173c705

Browse files
committed
Refactoring spec organization
2 parents a9b10d7 + c1ff7a4 commit 173c705

13 files changed

+7
-18
lines changed

.rspec

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--color

spec/base_spec.rb spec/draper/base_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'spec_helper'
2-
require 'draper'
32

43
describe Draper::Base do
54
before(:each){ ApplicationController.new.set_current_view_context }

spec/view_context_spec.rb spec/draper/view_context_spec.rb

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'spec_helper'
2-
require 'draper'
32

43
describe Draper::ViewContext do
54
let (:app_controller) do
@@ -22,14 +21,4 @@
2221
Draper::ViewContext.current = nil
2322
expect {app_controller.current_view_context}.should raise_exception(Exception)
2423
end
25-
26-
it "sets view_context every time" do
27-
app_controller_instance.stub(:view_context) { 'first' }
28-
app_controller_instance.set_current_view_context
29-
Draper::ViewContext.current.should == 'first'
30-
31-
app_controller_instance.stub(:view_context) { 'second' }
32-
app_controller_instance.set_current_view_context
33-
Draper::ViewContext.current.should == 'second'
34-
end
35-
end
24+
end

spec/spec_helper.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
require 'rubygems'
22
require 'bundler/setup'
33
Bundler.require
4-
require './spec/samples/application_helper.rb'
5-
Dir.glob(['./spec/samples/*.rb', './spec/support/*.rb']) do |file|
6-
require file
7-
end
4+
5+
Dir['./spec/support/**/*.rb'].each {|file| require file }
File renamed without changes.

spec/samples/application_controller.rb spec/support/samples/application_controller.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require './spec/support/samples/application_helper'
2+
13
module ActionController
24
class Base
35
@@before_filters = []
@@ -29,4 +31,4 @@ def self.hello
2931
end
3032
end
3133

32-
Draper::System.setup
34+
Draper::System.setup
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)