Skip to content

Instantly share code, notes, and snippets.

@rusllonrails
Created April 1, 2014 18:05
Show Gist options
  • Save rusllonrails/9919635 to your computer and use it in GitHub Desktop.
Save rusllonrails/9919635 to your computer and use it in GitHub Desktop.
Rspec cover class
lib/tasks/dummy.rake
namespace :db do
desc "Add system data"
task dummy: :environment do
SeedDummyData.run
end
end
class SeedDummyData
class << self
def run
do_something
end
def do_something
...here your logic bla bla bla
end
end
end
spec/tasks/seed_dummy_data_spec.rb
require "spec_helper"
describe "Seed dummy data task" do
before(:all) do
Rake::Task["db:dummy"].invoke
end
it "should populate 18 approaches" do
expect(Approach.count).to eq 17
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment