-
Notifications
You must be signed in to change notification settings - Fork 998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redmine now includes a optional tracker_id field #643
Conversation
By defining a tracker_id, you can make sure that the ticket will be created with the right "type". If it is not filled, then it fallbacks to default which is the first in the priority list that is available to the project.
looks like ci is 🔴 |
I haven't executed all the specs, just the one I modified (my fault). Here is the failed spec: IssueTracker.subclasses.each do |tracker_klass|
context tracker_klass do
it "should save tracker params" do
params = tracker_klass::Fields.inject({}){|hash,f| hash[f[0]] = "test_value"; hash }
params[:ticket_properties] = "card_type = defect" if tracker_klass == MingleTracker
params[:type] = tracker_klass.to_s
put :update, :id => @app.id, :app => {:issue_tracker_attributes => params}
@app.reload
tracker = @app.issue_tracker
expect(tracker).to be_a(tracker_klass)
tracker_klass::Fields.each do |field, field_info|
case field
when :ticket_properties
expect(tracker.send(field.to_sym)).to eq 'card_type = defect'
else
expect(tracker.send(field.to_sym)).to eq 'test_value'
end
end
end What is wrong is that it has a very simple "mock" for every field. This can be fixed in 2 ways:
The code that makes this test fails is here: def check_params
if Fields.detect {|f| self[f[0]].blank? && !f[1][:optional]}
errors.add :base, 'You must specify your Redmine URL, API token, Username, Password and Project ID'
end
# this is the code that fails the other test, because it trys to set "tracker_id=test_value"
if Fields.detect {|f| f[0] == :tracker_id && !self[f[0]].blank? && !/[0-9]/.match(self[f[0]].to_s)}
errors.add :base, 'Issue Tracker Id must be a number'
end
end |
Should I also extract it to a gem, as suggested by: #612 ? |
it can be good if you extract to a gem because I need to do it soon. |
any suggestion according to the (lack of) factory issue? |
Can you please provide instructions or an example gem? As a side question, can I refactory some tests and implement a factory for all the trackers or you have another idea in mind? While errbit works the way it is right now, I'm missing some instrumentations to do a better job. |
I've sent a pull request to the "errbit_redmine_plugin". I beleive that all oficial plugins should be at "errbit" organization. Are there any plans to move it there? I'm closing it right now as It has nothing more to do here. |
I agree about where the plugins should live. I just don't have permission to create repos in this organization. I think I'll be asking for that permission soon. I'll check out your PR now. |
By defining a tracker_id, you can make sure that
the ticket will be created with the right "type".
If it is not filled, then it fallbacks to default
which is the first in the priority list that is
available to the project.
this fixes #585