misc: Modernize the files and copy them from another extensions
This commit is contained in:
parent
833e597cda
commit
6630527824
78
Rakefile
78
Rakefile
|
@ -1,75 +1,15 @@
|
||||||
require 'rubygems'
|
require 'bundler'
|
||||||
require 'rake'
|
Bundler::GemHelper.install_tasks
|
||||||
require 'rake/testtask'
|
|
||||||
require 'rake/packagetask'
|
|
||||||
require 'rake/gempackagetask'
|
|
||||||
|
|
||||||
gemfile = File.expand_path('../spec/test_app/Gemfile', __FILE__)
|
require 'rspec/core/rake_task'
|
||||||
if File.exists?(gemfile) && (%w(spec cucumber).include?(ARGV.first.to_s) || ARGV.size == 0)
|
require 'spree/core/testing_support/common_rake'
|
||||||
require 'bundler'
|
|
||||||
ENV['BUNDLE_GEMFILE'] = gemfile
|
|
||||||
Bundler.setup
|
|
||||||
|
|
||||||
require 'rspec'
|
RSpec::Core::RakeTask.new
|
||||||
require 'rspec/core/rake_task'
|
|
||||||
RSpec::Core::RakeTask.new
|
|
||||||
|
|
||||||
require 'cucumber/rake/task'
|
task :default => [:spec]
|
||||||
Cucumber::Rake::Task.new do |t|
|
|
||||||
t.cucumber_opts = %w{--format progress}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
desc "Default Task"
|
desc 'Generates a dummy app for testing'
|
||||||
task :default => [:spec, :cucumber ]
|
|
||||||
|
|
||||||
spec = eval(File.read('sysmocom_dhl.gemspec'))
|
|
||||||
|
|
||||||
Rake::GemPackageTask.new(spec) do |p|
|
|
||||||
p.gem_spec = spec
|
|
||||||
end
|
|
||||||
|
|
||||||
desc "Release to gemcutter"
|
|
||||||
task :release => :package do
|
|
||||||
require 'rake/gemcutter'
|
|
||||||
Rake::Gemcutter::Tasks.new(spec).define
|
|
||||||
Rake::Task['gem:push'].invoke
|
|
||||||
end
|
|
||||||
|
|
||||||
desc "Default Task"
|
|
||||||
task :default => [ :spec ]
|
|
||||||
|
|
||||||
desc "Regenerates a rails 3 app for testing"
|
|
||||||
task :test_app do
|
task :test_app do
|
||||||
require '../spree/lib/generators/spree/test_app_generator'
|
ENV['LIB_NAME'] = 'sysmocom_dhl'
|
||||||
class SysmocomDhlTestAppGenerator < Spree::Generators::TestAppGenerator
|
Rake::Task['common:test_app'].invoke
|
||||||
|
|
||||||
def install_gems
|
|
||||||
inside "test_app" do
|
|
||||||
run 'bundle exec rake spree_core:install'
|
|
||||||
run 'bundle exec rake sysmocom_dhl:install'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def migrate_db
|
|
||||||
run_migrations
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
|
||||||
def full_path_for_local_gems
|
|
||||||
<<-gems
|
|
||||||
gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "../spree/", "core")}\'
|
|
||||||
gem 'sysmocom_dhl', :path => \'#{File.dirname(__FILE__)}\'
|
|
||||||
gems
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
SysmocomDhlTestAppGenerator.start
|
|
||||||
end
|
|
||||||
|
|
||||||
namespace :test_app do
|
|
||||||
desc 'Rebuild test and cucumber databases'
|
|
||||||
task :rebuild_dbs do
|
|
||||||
system("cd spec/test_app && bundle exec rake db:drop db:migrate RAILS_ENV=test && rake db:drop db:migrate RAILS_ENV=cucumber")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,14 +1,32 @@
|
||||||
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
# Configure Rails Environment
|
||||||
# from the project root directory.
|
ENV['RAILS_ENV'] = 'test'
|
||||||
ENV["RAILS_ENV"] ||= 'test'
|
|
||||||
require File.expand_path("../test_app/config/environment", __FILE__)
|
|
||||||
require 'rspec/rails'
|
|
||||||
|
|
||||||
# Requires supporting files with custom matchers and macros, etc,
|
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
||||||
# in ./support/ and its subdirectories.
|
|
||||||
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
require 'rspec/rails'
|
||||||
|
require 'ffaker'
|
||||||
|
|
||||||
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
|
# in spec/support/ and its subdirectories.
|
||||||
|
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
|
||||||
|
|
||||||
|
# Requires factories defined in spree_core
|
||||||
|
require 'spree/core/testing_support/factories'
|
||||||
|
require 'spree/core/testing_support/controller_requests'
|
||||||
|
require 'spree/core/testing_support/authorization_helpers'
|
||||||
|
require 'spree/core/url_helpers'
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
|
config.include FactoryGirl::Syntax::Methods
|
||||||
|
|
||||||
|
# == URL Helpers
|
||||||
|
#
|
||||||
|
# Allows access to Spree's routes in specs:
|
||||||
|
#
|
||||||
|
# visit spree.admin_path
|
||||||
|
# current_path.should eql(spree.products_path)
|
||||||
|
config.include Spree::Core::UrlHelpers
|
||||||
|
|
||||||
# == Mock Framework
|
# == Mock Framework
|
||||||
#
|
#
|
||||||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
||||||
|
@ -18,13 +36,11 @@ RSpec.configure do |config|
|
||||||
# config.mock_with :rr
|
# config.mock_with :rr
|
||||||
config.mock_with :rspec
|
config.mock_with :rspec
|
||||||
|
|
||||||
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||||
|
|
||||||
#config.include Devise::TestHelpers, :type => :controller
|
|
||||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||||
# examples within a transaction, comment the following line or assign false
|
# examples within a transaction, remove the following line or assign false
|
||||||
# instead of true.
|
# instead of true.
|
||||||
config.use_transactional_fixtures = true
|
config.use_transactional_fixtures = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@configuration ||= AppConfiguration.find_or_create_by_name("Default configuration")
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ Gem::Specification.new do |s|
|
||||||
s.description = 'Deal with shipping cost, zones, insurance'
|
s.description = 'Deal with shipping cost, zones, insurance'
|
||||||
s.required_ruby_version = '>= 1.9.1'
|
s.required_ruby_version = '>= 1.9.1'
|
||||||
|
|
||||||
|
s.author = 'Holger Freyther'
|
||||||
# s.author = 'David Heinemeier Hansson'
|
# s.author = 'David Heinemeier Hansson'
|
||||||
# s.email = 'david@loudthinking.com'
|
# s.email = 'david@loudthinking.com'
|
||||||
# s.homepage = 'http://www.rubyonrails.org'
|
# s.homepage = 'http://www.rubyonrails.org'
|
||||||
|
@ -17,4 +18,10 @@ Gem::Specification.new do |s|
|
||||||
s.requirements << 'none'
|
s.requirements << 'none'
|
||||||
|
|
||||||
s.add_dependency('spree_core', '>= 1.2.0')
|
s.add_dependency('spree_core', '>= 1.2.0')
|
||||||
|
|
||||||
|
s.add_development_dependency 'capybara', '1.0.1'
|
||||||
|
s.add_development_dependency 'factory_girl', '~> 2.6.4'
|
||||||
|
s.add_development_dependency 'ffaker'
|
||||||
|
s.add_development_dependency 'rspec-rails', '~> 2.9'
|
||||||
|
s.add_development_dependency 'sqlite3'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue