RSpec.describe "EitilWrapper::Jobs" do let(:user) { User.create(first_name: "Donald", last_name: "Duck") } it "should create a new method, if the new_job (perform_later) is used for a singleton method" do expect(User.methods).to include(:this_is_a_singleton_method_job) end it "should create a new method, if the new_job (perform_later) is used for an instance method" do expect(User.instance_methods).to include(:this_is_an_instance_method_job) end it "should create a new method, if the new_job_now (perform_now) is used for a singleton method" do expect(User.methods).to include(:this_is_a_singleton_method_job_now) end it "should create a new method, if the new_job_now (perform_now) is used for an instance method" do expect(User.instance_methods).to include(:this_is_an_instance_method_job_now) end it "should allow us to perform the created singleton perform_later method" do begin User.this_is_a_singleton_method_job status = 'passed' rescue status = 'failed' end expect(status).to eq 'passed' end it "should allow us to perform the created instance perform_later method" do begin user.this_is_an_instance_method_job status = 'passed' rescue status = 'failed' end expect(status).to eq 'passed' end it "should allow us to perform the created singleton perform_now method" do begin User.this_is_a_singleton_method_job_now status = 'passed' rescue status = 'failed' end expect(status).to eq 'passed' end it "should allow us to perform the created instance perform_now method" do begin user.this_is_an_instance_method_job_now status = 'passed' rescue status = 'failed' end expect(status).to eq 'passed' end it "should accept positional arguments" do return_value = User.this_is_a_singleton_method_job_now("positional_argument") expect(return_value).to eq "positional_argument" end it "should accept keyword arguments " do return_value = User.this_is_a_singleton_method_job_now(keyword_value: "keyword_argument") expect(return_value).to eq "keyword_argument" end end