-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1620 deletion of child ontologies (#1748)
* Make removed child ontologies "not present". * Scope default children association of acts_as_tree to present ontologies. * Show only present ontologies of this file. * Fix ontology factory. * Add cucumber features. * Fix restoring children. * Fix restoring a child ontology. * Add specs for restoring children. * Really fix restoring a child ontology. * Only save the ontology if it has changed or if it is a new record.
- Loading branch information
Showing
21 changed files
with
317 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Feature: RepositoryEditFile | ||
|
||
Scenario: View the Ontologies of the file (SingleOntology) | ||
Given I have uploaded an ontology | ||
When I visit the file view of the ontology | ||
Then I should see all the file's ontologies | ||
|
||
Scenario: View the Ontologies of the file (DistributedOntology) | ||
Given I have uploaded a distributed ontology | ||
When I visit the file view of the ontology | ||
Then I should see all the file's ontologies | ||
|
||
Scenario: View the Ontologies of the file (DistributedOntology with deleted children) | ||
Given I have uploaded a distributed ontology | ||
And Children of the ontology have been deleted | ||
When I visit the file view of the ontology | ||
Then I should see all the file's ontologies | ||
|
||
Scenario: View the Ontologies of the file (DistributedOntology with restored children) | ||
Given I have uploaded a distributed ontology | ||
And Children of the ontology have been deleted | ||
And Children of the ontology have been restored | ||
When I visit the file view of the ontology | ||
Then I should see all the file's ontologies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Feature: RepositoryFileBrowser | ||
|
||
Scenario: SingleOntology Display | ||
Given I have uploaded an ontology | ||
When I visit the file browser of the ontology's repository | ||
Then I should see the ontology's file | ||
And I should see the ontlogy next to the ontology's file | ||
And I should see no other ontologies next to the ontology's file | ||
|
||
Scenario: DistributedOntology Display | ||
Given I have uploaded a distributed ontology | ||
When I visit the file browser of the ontology's repository | ||
Then I should see the ontology's file | ||
And I should see the ontlogy and its children next to the ontology's file | ||
And I should see no other ontologies next to the ontology's file | ||
|
||
Scenario: DistributedOntology with Deleted Children Display | ||
Given I have uploaded a distributed ontology | ||
And Children of the ontology have been deleted | ||
When I visit the file browser of the ontology's repository | ||
Then I should see the ontology's file | ||
And I should see the ontlogy and its children next to the ontology's file | ||
And I should see no other ontologies next to the ontology's file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
def build_version_for(ontology) | ||
commit_oid = '1'*40 | ||
ontology.versions.build( | ||
{commit_oid: commit_oid, | ||
commit: FactoryGirl.create(:commit, commit_oid: commit_oid), | ||
basepath: File.basepath(ontology.path), | ||
file_extension: File.extname(ontology.path), | ||
fast_parse: false}, | ||
{without_protection: true}) | ||
end | ||
|
||
Given(/^I have uploaded a(.*) ontology$/) do |type| | ||
steps %Q{ | ||
Given I have an account | ||
And I am logged in | ||
And there is a#{type} ontology | ||
And I have permissions to edit the ontology | ||
And there is an ontology file | ||
} | ||
end | ||
|
||
Given(/^Children of the ontology have been deleted$/i) do | ||
@deleted_child = @ontology.children.last | ||
@deleted_child.present = false | ||
@deleted_child.save! | ||
|
||
build_version_for(@ontology).save! | ||
@ontology.children.each do |child| | ||
build_version_for(child).save! | ||
end | ||
end | ||
|
||
Given(/^Children of the ontology have been restored$/i) do | ||
@deleted_child.present =true | ||
@deleted_child.save! | ||
|
||
build_version_for(@ontology).save! | ||
@ontology.children.each do |child| | ||
build_version_for(child).save! | ||
end | ||
end | ||
|
||
When(/^I visit the file view of the ontology$/i) do | ||
# The request object does not contain a requested mime type, so we need to | ||
# stub this. | ||
allow_any_instance_of(FilesController). | ||
to receive(:existing_file_requested_as_html?). | ||
and_return(true) | ||
visit repository_tree_path(@ontology.repository, path: @ontology.path) | ||
end | ||
|
||
Then(/^I should see all the file's ontologies$/i) do | ||
# The file defines the DistributedOntolgy and its children. | ||
number = 1 + @ontology.children.count | ||
|
||
expect(page.find('#ontology-list-headline').text).to match(/\s+#{number}\s+/) | ||
expect(page).to have_selector('ul.ontology-list > li', count: number) | ||
end |
38 changes: 38 additions & 0 deletions
38
features/step_definitions/repository_file_browser_steps.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
When(/^I visit the file browser of the ontology's repository$/i) do | ||
visit repository_tree_path(@ontology.repository) | ||
end | ||
|
||
Then(/^I should see the ontology's file$/i) do | ||
file_cell_selector = 'table.file-table td.name' | ||
expect(page).to have_selector(file_cell_selector, count: 1) | ||
expect(find(file_cell_selector). | ||
has_link?(@ontology.path, polymorphic_path(@ontology))). | ||
to be(true) | ||
end | ||
|
||
Then(/^I should see the ontlogy next to the ontology's file$/i) do | ||
ontology_cell_selector = 'table.file-table td.ontology ul.ontology-list' | ||
expect(page).to have_selector(ontology_cell_selector, count: 1) | ||
expect(find(ontology_cell_selector). | ||
has_link?(@ontology.name, polymorphic_path(@ontology))). | ||
to be(true) | ||
end | ||
|
||
Then(/^I should see no other ontologies next to the ontology's file$/i) do | ||
ontology_cell_selector = 'table.file-table td.ontology ul.ontology-list' | ||
expect(find(ontology_cell_selector)). | ||
to have_selector('li', count: 1 + @ontology.children.count) | ||
end | ||
|
||
Then(/^I should see the ontlogy and its children next to the ontology's file$/i) do | ||
ontology_cell_selector = 'table.file-table td.ontology ul.ontology-list' | ||
expect(page).to have_selector(ontology_cell_selector, count: 1) | ||
expect(find(ontology_cell_selector). | ||
has_link?(@ontology.name, polymorphic_path(@ontology))). | ||
to be(true) | ||
@ontology.children.each do |child| | ||
expect(find(ontology_cell_selector). | ||
has_link?(child.name, polymorphic_path(child))). | ||
to be(true) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
spec sp = | ||
sort s | ||
op f:s->s | ||
. forall x:s . f(x) = x | ||
then | ||
. exists x:s . f(x) = x | ||
with s |-> s | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
spec sp = | ||
sort s | ||
op f:s->s | ||
. forall x:s . f(x) = x | ||
then | ||
. exists x:s . f(x) = x | ||
with s |-> s | ||
end | ||
|
||
spec sp1_renamed = | ||
sp hide f | ||
end |
Oops, something went wrong.