Class: Cukunity::CLI::FeaturesCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/cukunity/cli/features_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(parser) ⇒ FeaturesCommand

Returns a new instance of FeaturesCommand.



7
8
9
# File 'lib/cukunity/cli/features_command.rb', line 7

def initialize(parser)
  @parser = parser
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cukunity/cli/features_command.rb', line 11

def execute
  path = @parser.remaining_args.first
  if path.nil?
    path = Dir.pwd
    path = File.join(path, 'features') if File.directory?(File.join(path, 'features'))
  end
  if @parser.options.ios
    if @parser.options.android
      abort 'You cannot test both iOS and Android simultaneously. ' \
        'Please disable one of the platforms by using ' \
        '--no-ios or --no-android'
    end
    platform_flags = '~@android,@ios'
  elsif @parser.options.android
    platform_flags = '~@ios,@android'
  else
    abort 'You should specify which platform you want to test by specifying ' \
      'either --ios or --android'
  end
  cukunity = File.expand_path(File.join(File.dirname(__FILE__), '..', 'cucumber.rb'))

  cucumber_cmd_args = ['--require', cukunity, '--format', 'pretty', '-t', platform_flags, path]
  cucumber_cmd_args += @parser.cucumber_args
  system 'cucumber', *cucumber_cmd_args
end