Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separated unit and acceptance tests to isolate Rails-related dependen…
…cies
- Loading branch information
Showing
22 changed files
with
93 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
case ENV['RAILS_VERSION'] | ||
when '2.1' then | ||
gem 'activerecord', '~>2.1.0' | ||
when '3.0' then | ||
gem 'activerecord', '~>3.0.0' | ||
else | ||
gem 'activerecord', '~>2.3.0' | ||
end | ||
|
||
require 'active_record' | ||
require 'active_record/version' | ||
|
||
puts "Running specs using Rails #{ActiveRecord::VERSION::STRING}" | ||
|
||
require 'acceptance/models' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
spec/factory_girl/syntax/blueprint_spec.rb → spec/acceptance/syntax/blueprint_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/factory_girl/syntax/generate_spec.rb → spec/acceptance/syntax/generate_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/factory_girl/syntax/make_spec.rb → spec/acceptance/syntax/make_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/factory_girl/syntax/sham_spec.rb → spec/acceptance/syntax/sham_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,42 @@ | ||
$: << File.join(File.dirname(__FILE__), '..', 'lib') | ||
$: << File.join(File.dirname(__FILE__)) | ||
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib') | ||
$LOAD_PATH << File.join(File.dirname(__FILE__)) | ||
|
||
require 'rubygems' | ||
|
||
case ENV['RAILS_VERSION'] | ||
when '2.1' then | ||
gem 'activerecord', '~>2.1.0' | ||
when '3.0' then | ||
gem 'activerecord', '~>3.0.0' | ||
else | ||
gem 'activerecord', '~>2.3.0' | ||
end | ||
|
||
require 'active_record' | ||
require 'active_record/version' | ||
|
||
puts "Running specs using Rails #{ActiveRecord::VERSION::STRING}" | ||
|
||
require 'spec' | ||
require 'spec/autorun' | ||
require 'rr' | ||
|
||
require 'models' | ||
|
||
require 'factory_girl' | ||
|
||
Spec::Runner.configure do |config| | ||
config.mock_with RR::Adapters::Rspec | ||
end | ||
|
||
share_as :DefinesConstants do | ||
before do | ||
@defined_constants = [] | ||
end | ||
|
||
after do | ||
@defined_constants.reverse.each do |path| | ||
namespace, class_name = *constant_path(path) | ||
namespace.send(:remove_const, class_name) | ||
end | ||
end | ||
|
||
def define_constant(path, base = Object, &block) | ||
namespace, class_name = *constant_path(path) | ||
klass = Class.new(base) | ||
namespace.const_set(class_name, klass) | ||
klass.class_eval(&block) if block_given? | ||
@defined_constants << path | ||
klass | ||
end | ||
|
||
def constant_path(constant_name) | ||
names = constant_name.split('::') | ||
class_name = names.pop | ||
namespace = names.inject(Object) { |result, name| result.const_get(name) } | ||
[namespace, class_name] | ||
end | ||
end |