You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tests like this need to mock the call to the NetLinx compiler so they can be tested on a continuous integration platform without the need to install proprietary software. The real integration tests should still be available (and flagged as integration) so they can be run on a machine with the compiler installed.
it"compiles a .axs source code file"dofiles=test_file_generator.new'source-file-plain'files.compiled_files.eachdo |file|
# Delete any existing files.File.deletefileifFile.exists?file# Compiled files should not exist.File.exists?(file).shouldeqfalseend# Add source code file to the list of targets to compile.compilable.compiler_target_files << files.source_file# Run the compiler.compiler.compilecompilable# Compiled files should exist.files.compiled_files.eachdo |file|
File.exists?(file).shouldeqtrueendendifINTEGRATION_TEST
This is an example of how the call to the compiler was mocked:
describe"Wine"dolet(:wine_path){'~/.wine/drive_c/Program Files/Common Files/AMXShare/COM'}let(:source_file){File.expand_path'source-file-plain','spec/workspace/import-test'}let(:wine_command){"wine \"#{File.expand_path('nlrc.exe',wine_path)}\"\"#{source_file}\""}let(:io_double){double().tapdo |d|
d.should_receive(:read){''}d.should_receive(:close)end}it"can execute the compiler"do# Add source code file to the list of targets to compile.compilable.compiler_target_files << source_file# Stub File.exists? to force Wine path.File.should_receive(:exists?).at_least(:once)do |path|
path.include?('.wine') ? true : falseend# Stub popen to check for correct command.IO.should_receive(:popen)do |cmd|
cmd.shouldeqwine_commandio_doubleend# Run the compiler.compiler.compilecompilableendend
The text was updated successfully, but these errors were encountered:
Tests like this need to mock the call to the NetLinx compiler so they can be tested on a continuous integration platform without the need to install proprietary software. The real integration tests should still be available (and flagged as integration) so they can be run on a machine with the compiler installed.
This is an example of how the call to the compiler was mocked:
The text was updated successfully, but these errors were encountered: