active-triples 0.7.6 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -3
- data/AUTHORS +1 -1
- data/CHANGES.md +12 -17
- data/Gemfile +2 -0
- data/README.md +2 -2
- data/active-triples.gemspec +6 -5
- data/lib/active_triples.rb +56 -5
- data/lib/active_triples/configurable.rb +13 -17
- data/lib/active_triples/list.rb +22 -21
- data/lib/active_triples/persistable.rb +100 -0
- data/lib/active_triples/persistence_strategies/parent_strategy.rb +89 -0
- data/lib/active_triples/persistence_strategies/persistence_strategy.rb +77 -0
- data/lib/active_triples/persistence_strategies/repository_strategy.rb +78 -0
- data/lib/active_triples/properties.rb +2 -1
- data/lib/active_triples/rdf_source.rb +94 -159
- data/lib/active_triples/relation.rb +17 -45
- data/lib/active_triples/repositories.rb +23 -9
- data/lib/active_triples/version.rb +1 -1
- data/spec/active_triples/configurable_spec.rb +5 -9
- data/spec/active_triples/identifiable_spec.rb +1 -18
- data/spec/active_triples/list_spec.rb +0 -4
- data/spec/active_triples/persistable_spec.rb +93 -0
- data/spec/active_triples/persistence_strategies/parent_strategy_spec.rb +93 -0
- data/spec/active_triples/persistence_strategies/persistence_strategy_spec.rb +24 -0
- data/spec/active_triples/persistence_strategies/repository_strategy_spec.rb +120 -0
- data/spec/active_triples/rdf_source_spec.rb +217 -9
- data/spec/active_triples/relation_spec.rb +51 -4
- data/spec/active_triples/repositories_spec.rb +17 -7
- data/spec/active_triples/resource_spec.rb +6 -53
- data/spec/active_triples_spec.rb +50 -1
- data/spec/spec_helper.rb +5 -1
- data/spec/support/active_model_lint.rb +6 -3
- data/spec/support/dummies/basic_persistable.rb +13 -0
- data/spec/support/shared_examples/persistence_strategy.rb +36 -0
- metadata +32 -9
- data/spec/active_triples/validations_spec.rb +0 -33
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ActiveTriples::Resource do
|
4
|
-
|
5
|
-
subject { MyResource.new }
|
6
|
-
|
7
|
-
before(:all) do
|
8
|
-
class MyResource < ActiveTriples::Resource
|
9
|
-
property :title, predicate: ::RDF::DC.title
|
10
|
-
|
11
|
-
validates_presence_of :title
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
after(:all) do
|
16
|
-
Object.send(:remove_const, :MyResource)
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "validation" do
|
20
|
-
it "should have a presence validator on the class" do
|
21
|
-
expect(MyResource.validators.first).to be_a(ActiveModel::Validations::PresenceValidator)
|
22
|
-
end
|
23
|
-
it "should have validation callbacks" do
|
24
|
-
expect(MyResource._validate_callbacks).to be_present
|
25
|
-
end
|
26
|
-
it "should run the validations" do
|
27
|
-
expect(subject).to receive(:run_validations!)
|
28
|
-
subject.valid?
|
29
|
-
end
|
30
|
-
it { is_expected.to be_invalid }
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|