I am trying to call app_exec from inside a custom class within my launch_steps.rb file but I keep getting this exception:
undefined method `app_exec' for MyJSON:Class (NoMethodError)
Then (/^I check the json/) do
MyJSON.requestJson
puts MyJSON.json
# If I put app_exec here, it will work fine
# app_exec( "getJsonMessages:", true )
end
class MyJSON
include Frank::Cucumber::FrankHelper
@json = nil
@flush = true;
def self.requestJson
@json=app_exec( "getJsonMessages:", true ) #undefined method even with the inclusion of FrankHelper
if @json.count==0
@json = nil
raise "No Data Returned From Application"
end
end
def self.json
@json
end
end
The issue was the fact that I was including instead of extending:
I am still not sure why I could not reference it without extending though. Even if I tried the following it would not work: