I am developing a Rails app. I have a helper under app/helpers/ , that's the db_data_helper.rb .
The methods in this db_data_helper are mainly used to execute sql dump file to load data to database. And these methods in the helper are used in some Rake task.
Some sample code of the helper:
db_data_helper.rb:
module DbDataHelper
def self.load_data
# CODE TO EXECUTE SQL dump files
end
...
...
end
Now, I would like to test this helper in Rspec but I am not sure how to implement the test in Rspec for a helper like this. Could some one help me on this?
I'd simply create a class in my spec file:
class DummyDbDataHelper
extend DbDataHelper
end
describe DummyDbDataHelper do
it "tests the load_data method" do
DummyDbDataHelper.load_data.should ...
end
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.