Sha256: 5c092e8695a5ee5e0a4eeb9bb24f0e9cfebdd2f33d5e73df8505480538d4b6c7

Contents?: true

Size: 1.21 KB

Versions: 23

Compression:

Stored size: 1.21 KB

Contents

require 'test_helper'
require 'rails'

class AdminpanelRakeTest < ActiveSupport::TestCase
  include Rake
  include
  Rake.application.rake_require 'tasks/adminpanel/adminpanel'
  Rake::Task.define_task(:environment)

  def test_populate_task
    I18n.enforce_available_locales = false
    I18n.reload!
    products_count = Adminpanel::Product.count
    Rake.application.invoke_task "adminpanel:populate[10, product, name:name description:lorem price:number]"
    assert_equal products_count + 10, Adminpanel::Product.count
    # assert true
  end

  def test_section_task
    Rake.application.invoke_task "adminpanel:section[Mission Mars, about us]"
    last_section = Adminpanel::Section.last
    assert_equal 'Mission Mars', last_section.name
    assert_equal 'About us', last_section.page
    assert_equal 'mission_mars', last_section.key
    assert_equal false, last_section.has_description
    assert_equal false, last_section.has_image
  end

  def test_user_task
    Rake.application.invoke_task 'adminpanel:user'
    generated_user = Adminpanel::User.last
    assert_equal 'webmaster@codn.mx', generated_user.email
    assert_equal 'Webmaster', generated_user.name
    assert_equal 'Admin', generated_user.role.name
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
adminpanel-3.4.7 test/tasks/adminpanel_rake_test.rb
adminpanel-3.4.6 test/tasks/adminpanel_rake_test.rb
adminpanel-3.4.5 test/tasks/adminpanel_rake_test.rb
adminpanel-3.4.4 test/tasks/adminpanel_rake_test.rb
adminpanel-3.4.3 test/tasks/adminpanel_rake_test.rb
adminpanel-3.4.2 test/tasks/adminpanel_rake_test.rb
adminpanel-3.4.1 test/tasks/adminpanel_rake_test.rb
adminpanel-3.4.0 test/tasks/adminpanel_rake_test.rb
adminpanel-3.3.4 test/tasks/adminpanel_rake_test.rb
adminpanel-3.3.3 test/tasks/adminpanel_rake_test.rb
adminpanel-3.3.0 test/tasks/adminpanel_rake_test.rb
adminpanel-3.2.1 test/tasks/adminpanel_rake_test.rb
adminpanel-3.2.0 test/tasks/adminpanel_rake_test.rb
adminpanel-3.1.0 test/tasks/adminpanel_rake_test.rb
adminpanel-3.0.0 test/tasks/adminpanel_rake_test.rb
adminpanel-2.6.1 test/tasks/adminpanel_rake_test.rb
adminpanel-2.6.0 test/tasks/adminpanel_rake_test.rb
adminpanel-2.5.5 test/tasks/adminpanel_rake_test.rb
adminpanel-2.5.4 test/tasks/adminpanel_rake_test.rb
adminpanel-2.5.3 test/tasks/adminpanel_rake_test.rb