/usr/lib/obs/tests/appliance/spec/spec_helper.rb is in obs-server 2.7.1-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 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 36 37 38 39 40 41 42 43 44 45 46 47 | require 'wait_for_ajax.rb'
# OBS Appliance spec helper.
#
RSpec.configure do |config|
#rspec-expectations config goes here.
config.expect_with :rspec do |expectations|
# to disable deprecated should syntax
expectations.syntax = :expect
end
config.include WaitForAjax
config.before(:suite) do
FileUtils.rm_rf(SCREENSHOT_DIR)
FileUtils.mkdir_p(SCREENSHOT_DIR)
end
config.after(:each) do |example|
if example.exception
take_screenshot(example)
end
end
# Limits the available syntax to the non-monkey patched
config.disable_monkey_patching!
end
# for capybara rspec support
require 'support/capybara'
SCREENSHOT_DIR = "/tmp/rspec_screens"
def take_screenshot(example)
meta = example.metadata
filename = File.basename(meta[:file_path])
line_number = meta[:line_number]
screenshot_name = "screenshot-#{filename}-#{line_number}.png"
screenshot_path = File.join(SCREENSHOT_DIR, screenshot_name)
page.save_screenshot(screenshot_path)
puts meta[:full_description] + "\n Screenshot: #{screenshot_path}"
end
def obs_login (user,password)
visit "/user/login"
fill_in 'user_login', with: user
fill_in 'user_password', with: password
click_button('Log In ยป')
first(:link,'Logout')
end
|