Reputation: 31
I am having a rspec ruby file named test_spec.rb . I want to add below command inside the file so to make it run when I run the rspec file.
exec("sudo gsutil cp test_object.txt gs://sample-bucket1")
But when I am running my code as soon as above command runs it stops the further execution. How can I prevent it.
Below is my Rspec code.
A=C.new
context "Bucket Resource : " do
#setup data
before('The Original should create object') do
#some code here
exec("sudo gsutil cp test_object.txt gs://sample-bucket1")
end
#Positive Test cases
describe "The Original should create object" do
it "Should execute successfully and return an instance " do
#define namevar
entity = "[email protected]"
#define build params
build_params = {
entity: "[email protected]",
role: "OWNER",
}
expect(A.create_instance(build_params)).to be_an_instance_of(B)
end
end
after('The Original should create object') do
#some code here
end
end
After running the above code, after hook is not called.
Upvotes: 0
Views: 417
Reputation: 4920
You can use back tick for this inside your rspec file:
`sudo gsutil cp test_object.txt gs://sample-bucket1`
Upvotes: 1