Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions lib/motion/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,26 @@ def create_ipa
end
end

desc "Run the test/spec suite"
task :spec do
App.config.spec_mode = true
Rake::Task["simulator"].invoke
desc "Run entire test/spec suite"
task :spec => ['spec:all']

namespace :spec do
task :all do
App.config.spec_mode = true
Rake::Task["simulator"].invoke
end

desc "Run unit test/spec suite"
task :units do
App.config.spec_mode = :units
Rake::Task["simulator"].invoke
end

desc "Run functional test/spec suite"
task :functionals do
App.config.spec_mode = :functionals
Rake::Task["simulator"].invoke
end
end

desc "Deploy on the device"
Expand Down
30 changes: 24 additions & 6 deletions lib/motion/project/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def relpath(path)

variable :files, :xcode_dir, :sdk_version, :deployment_target, :frameworks,
:weak_frameworks, :libs, :delegate_class, :name, :build_dir,
:resources_dir, :specs_dir, :identifier, :codesign_certificate,
:provisioning_profile, :device_family, :interface_orientations, :version,
:short_version, :icons, :prerendered_icon, :background_modes, :seed_id,
:entitlements, :fonts, :status_bar_style, :motiondir
:resources_dir, :specs_dir, :unit_specs_dir, :functional_specs_dir,
:identifier, :codesign_certificate, :provisioning_profile, :device_family,
:interface_orientations, :version, :short_version, :icons, :prerendered_icon,
:background_modes, :seed_id, :entitlements, :fonts, :status_bar_style, :motiondir

attr_accessor :spec_mode

Expand All @@ -67,7 +67,7 @@ def initialize(project_dir, build_mode)
@name = 'Untitled'
@resources_dir = File.join(project_dir, 'resources')
@build_dir = File.join(project_dir, 'build')
@specs_dir = File.join(project_dir, 'spec')
self.specs_dir = File.join(project_dir, 'spec')
@device_family = :iphone
@bundle_signature = '????'
@interface_orientations = [:portrait, :landscape_left, :landscape_right]
Expand Down Expand Up @@ -322,14 +322,32 @@ def bridgesupport_files
end
end

def specs_dir=(_specs_dir)
@specs_dir = _specs_dir
@unit_specs_dir = File.join(@specs_dir, 'unit')
@functional_specs_dir = File.join(@specs_dir, 'functional')
@specs_dir
end

def current_specs_dir
case spec_mode
when :units
@unit_specs_dir
when :functionals
@functional_specs_dir
else
@specs_dir
end
end

def spec_files
@spec_files ||= begin
# Core library + core helpers.
core = Dir.chdir(File.join(File.dirname(__FILE__), '..')) { (['spec.rb'] + Dir.glob(File.join('spec', 'helpers', '*.rb'))).map { |x| File.expand_path(x) } }
# Project helpers.
helpers = Dir.glob(File.join(specs_dir, 'helpers', '*.rb'))
# Project specs.
specs = Dir.glob(File.join(specs_dir, '**', '*.rb')) - helpers
specs = Dir.glob(File.join(current_specs_dir, '**', '*.rb')) - helpers
if files_filter = ENV['files']
# Filter specs we want to run. A filter can be either the basename of a spec file or its path.
files_filter = files_filter.split(',')
Expand Down