Book Image

Redmine Plugin Extension and Development

By : Alex Bevilacqua
Book Image

Redmine Plugin Extension and Development

By: Alex Bevilacqua

Overview of this book

Table of Contents (16 chapters)
Redmine Plugin Extension and Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Writing integration tests


When we want to test more than one component and examine how they'll function together, or if we want to test the behavior, we write integration tests.

For a more in depth look at Rails integration tests, including what helpers are available, visit http://guides.rubyonrails.org/testing.html#integration-testing.

The following is an example of an integration test that accesses a category with an explicitly defined whitelist:

require File.dirname(__FILE__) + '/../test_helper'

class AccessingContentTest < ActionController::IntegrationTest
  fixtures :projects, :users
  plugin_fixtures :kb_articles, :kb_categories
  def setup
    @project = Project.find(1)
    @user_1 = User.find(1)
    @user_2 = User.find(2)
  end
  
  test "access category with an explicit whitelist defined" do
    cat_wl = KbCategory.find(2)
    assert !cat_wl.user_whitelist.blank?, "Category Whitelist expected to be populated"

    assert !cat_wl.blacklisted?(@user_1), "User 1 is supposed to be...