added a test for the converter rake task
This commit is contained in:
parent
bf56364019
commit
dfbc01ca7a
2 changed files with 31 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
namespace :migration do
|
||||
namespace :migrations do
|
||||
desc 'make old registered services into the new class specific services'
|
||||
task :service_reclassify do
|
||||
Service.all.each do |s|
|
||||
30
spec/lib/tasks/migrations_spec.rb
Normal file
30
spec/lib/tasks/migrations_spec.rb
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
require 'spec_helper'
|
||||
require File.join(Rails.root, 'lib/hcard')
|
||||
|
||||
describe 'migrations' do
|
||||
|
||||
|
||||
describe 'service_reclassify' do
|
||||
it 'makes classless servcices have class' do
|
||||
s1 = Service.new(:access_token => "foo", :access_secret => "barbar", :provider => "facebook")
|
||||
s2 = Service.new(:access_token => "foo", :access_secret => "barbar", :provider => "twitter")
|
||||
s1.save
|
||||
s2.save
|
||||
|
||||
require "rake"
|
||||
@rake = Rake::Application.new
|
||||
Rake.application = @rake
|
||||
Rake.application.rake_require "lib/tasks/migrations"
|
||||
Rake::Task.define_task(:environment)
|
||||
@rake['migrations:service_reclassify'].invoke
|
||||
|
||||
Service.all.any?{|x| x.class.name == "Services::Twitter"}.should be true
|
||||
Service.all.any?{|x| x.class.name == "Services::Facebook"}.should be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in a new issue