Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4602832
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:03:02+00:00 2026-05-22T00:03:02+00:00

Me and my team have been heavily producing plugins for a Rails 2.3 app

  • 0

Me and my team have been heavily producing plugins for a Rails 2.3 app (Redmine, currently 1.1 branch). So far, we have contained from polluting Redmine’s base code by writing most of our changes as rails plugins. This has two main benefits:

  • Most of the time, integration with newer Redmine versions is straightforward.
  • We can enable/disable some custom behavior by dropping/removing a plugin. In fact, this is a key factor for us, because our clients have quite disparate requirements.

Some of our plugins monkey-patch Redmine’s classes. For instance, we have a plugin that “injects” stricter validations to the Issue model: start_date, due_date and estimated_hours are required for leaf? issues.

This monkey-patching stuff makes several tests fail and/or raise exceptions. This very plugin, for instance, makes the create_issue! method from IssueNestedSetTest class to create invalid issues (i.e. lacking the required attributes the plugin is enforcing):

# Helper that creates an issue with default attributes
def create_issue!(attributes={})
  Issue.create!({:project_id => 1, :tracker_id => 1, :author_id => 1, :subject => 'test'}.merge(attributes))
end

Since the plugin may or may not be active, we would not like to change the test itself. We think it’s best the plugin monkey-patch the test accordingly:

module StandardTestPatches
  module InstanceMethods
    def create_issue_with_gespro_standards!(attributes={})
      attributes.merge!(:start_date => 1.day.ago, :due_date => 1.day.from_now, :estimated_hours => 8)
      create_issue_without_gespro_standards!(attributes)
    end
  end

  def self.included(base)
    base.send :include, InstanceMethods
    base.class_eval do
      alias_method_chain :create_issue!, :gespro_standards
    end
  end
end

However since our plugin’s init.rb file is required before the tests classes are loaded we can’t monkey-patch the IssueNestedSetTest class there.

Is there a way to monkey-patch rails tests from plugins?

UPDATE: Still an open question. Making it available at http://www.redmine.org/boards/1/topics/23672

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:03:03+00:00Added an answer on May 22, 2026 at 12:03 am

    Whenever I write Redmine or ChiliProject plugins I always assume that:

    • the plugins’ tests will run on their own (inside of the plugin dir)
    • the plugin might modify the core code enough that the core tests will fail

    I’ve tried to help others work around this by patching the core tests but we never found a good solution. Either the test would change in the core, another plugin would break something, or something else. I even tried to mock out the interfaces in the tests but maintaining them were a time killer.

    What I recommend (and do) is:

    1. Remove all non-core plugins
    2. Check that the core tests pass
    3. Install PluginA
    4. cd into PluginA’s directory
    5. Run PluginA’s tests in isolation

    (And you might run into problems later on if PluginA and PluginB are both installed)

    Sorry there isn’t a better solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi have a repository checkout (SVN) which has been heavily modified by a team
My team has a new Asp.net MVC intranet app. I have been doing some
I work in the Systems & admin team and have been given the task
I have been trying to setup git for our web development team unsuccessfully. Some
I have been asked to create some functionality in which marketing team send users
I have been using git and github with my small team of developers for
We have been looking to implement Agile methodology within our geographically distributed development team,
We (small team) currently have our Visual Studio projects on a network drive (no
I'm currently setting up CI for my project and have team city configure and
I'm part of a testing team and have been tasked with behaving badly using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.