Skip to content

Commit

Permalink
Do not try test_project node into the #test-case-view div.
Browse files Browse the repository at this point in the history
Fixes ActiveRecord::RecordNotFound Couldn't find Impasse::TestSuite error.
refs cforce#9
  • Loading branch information
AndreMiras committed Jun 29, 2015
1 parent 8848154 commit 7325b1e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app/controllers/impasse_test_case_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,11 @@ def get_node(node_params)

if node.is_test_case?
test_case = Impasse::TestCase.find(node_params[:id])
else
elsif node.is_test_suite?
test_case = Impasse::TestSuite.find(node_params[:id])
else
# test_project does not have a dedicated model
test_case = nil
end

[node, test_case]
Expand Down
14 changes: 11 additions & 3 deletions assets/javascripts/test_case_tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,17 @@ jQuery(document).ready(function ($) {
})
.bind("select_node.jstree", function(e, data) {
$("#test-case-view").block(impasse_loading_options());
var node_id = data.rslt.obj.attr("id").replace("node_", "");
location.replace("#testcase-" + node_id);
show_test_case(node_id);
var node = data.rslt.obj;
var node_id = node.attr("id").replace("node_", "");
// test_project has nothing to show in the test case view
if (node.attr('rel') == 'test_project') {
location.replace("#");
$("#test-case-view").html("");
}
else {
location.replace("#testcase-" + node_id);
show_test_case(node_id);
}
});

$("#testcase-dialog .add-test-step").live("click", function() {
Expand Down

0 comments on commit 7325b1e

Please sign in to comment.