Is there a way to call a ruby script a within another ruby script b? I have a ruby script which performs the website login (login.rb) and another script order_create.rb. I want to call login.rb first and then execute order_create.rb next. Please suggest.
Order_Created.rb:-
@@order_data = YAML.load(File.open'C:\Users\order_details.yaml') def fill_order_form(order_data)
fill_in 'Firstname', :with => order_data['firstname']
fill_in 'Lastname', :with => order_data['lastname']
fill_in 'ZIP', :with => order_data['zip']
click_button 'Continue'
end
order_detail.yaml :-
firstname: "Order"
lastname: "Test"
zip: "90341"
login.rb:-
require './order_create.rb'
def login
#login code here
fill_order_form(@@order_data)
end
Error on running login.rb :- undefined method `fill_order_form' for #<#<Class:0x3e344e0>:0x4248ba0>
requirewill execute the script in the current Ruby process,systemwill open a new process which you can run the script with (and provide process-level arguments to),Open3will let you open a new process to execute the script which you can then pipe input and output to/from, etc.