Sha256: 59bfa3330e5dcea9e62efa7563e9c001b8a08966d23d803c9bd4f6ad1cb7eae2

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

require 'test_helper'
require 'rails'

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
  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

4 entries across 4 versions & 1 rubygems

Version Path
adminpanel-3.6.1 test/tasks/adminpanel_rake_test.rb
adminpanel-3.6.0 test/tasks/adminpanel_rake_test.rb
adminpanel-3.5.1 test/tasks/adminpanel_rake_test.rb
adminpanel-3.5.0 test/tasks/adminpanel_rake_test.rb