Sha256: deb3f63fadc190a8ddb5f9f84d72f6cf6afbc419125cb33f0cba5fffd33b9a41

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

require File.expand_path('../../../../../helper', __FILE__)

describe('Ramaze::Helper::Category') do
  behaves_like :capybara

  category_group = ::Categories::Model::CategoryGroup.create(
    :name => 'Spec group'
  )

  category = ::Categories::Model::Category.create(
    :name              => 'Spec category',
    :category_group_id => category_group.id
  )

  it('Validate a valid category group') do
    url = ::Categories::Controller::Categories.r(
      :index, category_group.id
    ).to_s

    visit(url)

    current_path.should == "/admin/categories/index/#{category_group.id}"
  end

  it('Validate an invalid category group') do
    url = ::Categories::Controller::Categories.r(
      :index, category_group.id + 1
    ).to_s

    visit(url)

    current_path.should == '/admin/category-groups/index'
  end

  it('Validate a valid category') do
    group_id = category_group.id
    cat_id   = category.id

    url = ::Categories::Controller::Categories.r(
      :edit, group_id, cat_id
    ).to_s

    visit(url)

    current_path.should == "/admin/categories/edit/#{group_id}/#{cat_id}"
  end

  it('Validate an invalid category') do
    group_id = category_group.id

    url = ::Categories::Controller::Categories.r(
      :edit, group_id, group_id + 1
    ).to_s

    visit(url)

    current_path.should == "/admin/categories/index/#{group_id}"
  end

  category.destroy
  category_group.destroy
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zen-0.3 spec/zen/package/categories/helper/category.rb
zen-0.3b1 spec/zen/package/categories/helper/category.rb
zen-0.3b spec/zen/package/categories/helper/category.rb