Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Oct 12, 2023
2 parents 801b693 + a96c819 commit 37408c5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
16 changes: 7 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/goo.git
revision: 0019b4b7b6e18be15fe068084510c03b674d23d8
revision: 69466682c1e9cb2c338539195013dbec9714ca7d
branch: development
specs:
goo (0.0.2)
Expand Down Expand Up @@ -53,7 +53,7 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git
revision: 1204ede68ed0a5af5e3fb355172496d5e0134544
revision: 087c28b92527a1df1665d25c38277456e9acf06e
branch: development
specs:
ontologies_linked_data (0.0.1)
Expand Down Expand Up @@ -105,12 +105,11 @@ GEM
multi_json (~> 1.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
airbrussh (1.4.2)
airbrussh (1.5.0)
sshkit (>= 1.6.1, != 1.7.0)
backports (3.24.1)
bcrypt (3.1.19)
bcrypt_pbkdf (1.1.0)
benchmark-ips (2.12.0)
bigdecimal (1.4.2)
builder (3.2.4)
capistrano (3.17.3)
Expand Down Expand Up @@ -160,7 +159,7 @@ GEM
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
ffi (1.15.5)
ffi (1.16.3)
get_process_mem (0.2.7)
ffi (~> 1.0)
google-apis-analytics_v3 (0.13.0)
Expand Down Expand Up @@ -208,7 +207,7 @@ GEM
method_source (1.0.0)
mime-types (3.5.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2023.0808)
mime-types-data (3.2023.1003)
mini_mime (1.1.5)
minitest (4.7.5)
minitest-stub_any_instance (1.0.3)
Expand All @@ -217,7 +216,7 @@ GEM
multi_json (1.15.0)
multipart-post (2.3.0)
net-http-persistent (2.9.4)
net-imap (0.3.7)
net-imap (0.4.1)
date
net-protocol
net-pop (0.1.2)
Expand Down Expand Up @@ -324,7 +323,7 @@ GEM
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
systemu (2.6.5)
temple (0.10.2)
temple (0.10.3)
tilt (2.3.0)
timeout (0.4.0)
trailblazer-option (0.1.2)
Expand Down Expand Up @@ -355,7 +354,6 @@ PLATFORMS
DEPENDENCIES
activesupport (~> 3.1)
bcrypt_pbkdf (>= 1.0, < 2.0)
benchmark-ips (~> 2.12)
bigdecimal (= 1.4.2)
capistrano (~> 3)
capistrano-bundler
Expand Down
3 changes: 2 additions & 1 deletion helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def populate_from_params(obj, params)
# Deal with empty strings for String and URI
empty_string = value.is_a?(String) && value.empty?
old_string_value_exists = obj.respond_to?(attribute) && (obj.send(attribute).is_a?(String) || obj.send(attribute).is_a?(RDF::URI))
old_string_value_exists = old_string_value_exists || (obj.respond_to?(attribute) && obj.send(attribute).is_a?(LinkedData::Models::Base))
if old_string_value_exists && empty_string
value = nil
elsif empty_string
Expand Down Expand Up @@ -63,7 +64,7 @@ def populate_from_params(obj, params)
# Replace the initial value with the object, handling Arrays as appropriate
if value.is_a?(Array)
value = value.map {|e| attr_cls.find(uri_as_needed(e)).include(attr_cls.attributes).first}
else
elsif !value.nil?
value = attr_cls.find(uri_as_needed(value)).include(attr_cls.attributes).first
end
elsif attr_cls
Expand Down
26 changes: 26 additions & 0 deletions test/controllers/test_ontologies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,32 @@ def test_download_acl_only
end


def test_detach_a_view
view = Ontology.find(@@view_acronym).include(:viewOf).first
ont = view.viewOf
refute_nil view
refute_nil ont

remove_view_of = {viewOf: ''}
patch "/ontologies/#{@@view_acronym}", MultiJson.dump(remove_view_of), "CONTENT_TYPE" => "application/json"

assert last_response.status == 204

get "/ontologies/#{@@view_acronym}"
onto = MultiJson.load(last_response.body)
assert_nil onto["viewOf"]


add_view_of = {viewOf: @@acronym}
patch "/ontologies/#{@@view_acronym}", MultiJson.dump(add_view_of), "CONTENT_TYPE" => "application/json"

assert last_response.status == 204

get "/ontologies/#{@@view_acronym}"
onto = MultiJson.load(last_response.body)
assert_equal onto["viewOf"], ont.id.to_s
end

private

def check400(response)
Expand Down

0 comments on commit 37408c5

Please sign in to comment.