Class: InfinityTest::TestLibrary::Rspec

Inherits:
InfinityTest::TestFramework show all
Defined in:
lib/infinity_test/test_library/rspec.rb

Instance Attribute Summary

Attributes inherited from InfinityTest::TestFramework

#application, #message, #rubies, #specific_options, #test_pattern

Instance Method Summary collapse

Methods inherited from InfinityTest::TestFramework

#all_files, create_accessors, #create_pattern_instance_variables, #decide_files, parse_results, #test_files, #test_message

Methods included from Builder

#construct_command, #construct_commands, #resolve_options, #run_with_bundler!, #run_without_bundler!

Methods included from Environment

#environments

Methods included from BinaryPath

#have_binary?, included, #print_message, #rvm_bin_path, #search_binary

Constructor Details

#initialize(options = {}) ⇒ Rspec

rspec = InfinityTest::Rspec.new(:rubies => '1.9.1,1.9.2') rspec.rubies # => '1.9.1,1.9.2' rspec.test_pattern # => 'spec/**/*_spec.rb'



14
15
16
17
# File 'lib/infinity_test/test_library/rspec.rb', line 14

def initialize(options={})
  super(options)
  @test_pattern = 'spec/**/*_spec.rb'
end

Instance Method Details

#construct_rubies_commands(file = nil) ⇒ Object

Construct all the commands for each ruby First, try to find the rspec one binary, and if don't have installed try to find rspec two, and raise/puts an Error if don't find it. After that, verifying if the user have a Gemfile, and if has, run with “bundle exec” command, else will run normally



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/infinity_test/test_library/rspec.rb', line 25

def construct_rubies_commands(file=nil)
  commands = {}
  environments do |environment, ruby_version|
    rspec_binary = search_rspec_two(environment)
    rspec_binary = search_rspec_one(environment) unless have_binary?(rspec_binary)
    specific_options = @specific_options[ruby_version]
    commands[ruby_version] = construct_command(
                                :for => ruby_version,
                                :binary => rspec_binary,
                                :file => file,
                                :environment => environment,
                                :specific_options => specific_options)
  end
  commands
end

#failure?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/infinity_test/test_library/rspec.rb', line 50

def failure?
  @failures > 0
end

#pending?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/infinity_test/test_library/rspec.rb', line 54

def pending?
  @pending > 0 and not failure?
end

#search_files(file_pattern) ⇒ Object



41
42
43
# File 'lib/infinity_test/test_library/rspec.rb', line 41

def search_files(file_pattern)
  all_files.grep(/#{file_pattern}/i).join(' ')
end

#sucess?Boolean

Returns:

  • (Boolean)


45
46
47
48
# File 'lib/infinity_test/test_library/rspec.rb', line 45

def sucess?
  return false if failure? or pending?
  true
end