Sha256: 026306e072ca12294469a21340c06415c6f0d610bd8401d8cac367e28e65f6e0

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

require 'test_helper'

class AdminpanelRakeTest < ActiveSupport::TestCase
  include Rake
  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.com', generated_user.email
    assert_equal 'Webmaster', generated_user.name
    assert_equal 'Admin', generated_user.rol.name
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adminpanel-2.2.5 test/tasks/adminpanel_rake_test.rb
adminpanel-2.2.4 test/tasks/adminpanel_rake_test.rb
adminpanel-2.2.3 test/tasks/adminpanel_rake_test.rb
adminpanel-2.2.2 test/tasks/adminpanel_rake_test.rb
adminpanel-2.2.1 test/tasks/adminpanel_rake_test.rb
adminpanel-2.2.0 test/tasks/adminpanel_rake_test.rb