spec/patterns/strong_ruleset_spec.rb in rails-patterns-0.9.0 vs spec/patterns/strong_ruleset_spec.rb in rails-patterns-0.10.0
- old
+ new
@@ -1,19 +1,19 @@
-RSpec.describe StrongRuleset do
+RSpec.describe Patterns::StrongRuleset do
it 'inherites from Ruleset' do
- custom_strong_ruleset_klass = Class.new(StrongRuleset)
- expect(custom_strong_ruleset_klass.ancestors).to include Ruleset
+ custom_strong_ruleset_klass = Class.new(Patterns::StrongRuleset)
+ expect(custom_strong_ruleset_klass.ancestors).to include Patterns::Ruleset
end
context 'when any of rules is not applicable' do
it 'is not satisfied' do
with_mocked_rules do |rules|
subject = double
rules << mock_rule(:rule_1, is_applicable: false)
rules << mock_rule(:rule_2)
- custom_ruleset_klass = Class.new(StrongRuleset)
+ custom_ruleset_klass = Class.new(Patterns::StrongRuleset)
custom_ruleset_klass.add_rule(:rule_1)
custom_ruleset_klass.add_rule(:rule_2)
expect(custom_ruleset_klass.new(subject).satisfied?).to eq false
end
@@ -24,11 +24,11 @@
with_mocked_rules do |rules|
subject = double
rules << mock_rule(:rule_1, is_applicable: false, is_satisfied: false)
rules << mock_rule(:rule_2)
- custom_ruleset_klass = Class.new(StrongRuleset)
+ custom_ruleset_klass = Class.new(Patterns::StrongRuleset)
custom_ruleset_klass.add_rule(:rule_1)
custom_ruleset_klass.add_rule(:rule_2)
expect(custom_ruleset_klass.new(subject).forceable?).to eq false
end
@@ -39,11 +39,11 @@
with_mocked_rules do |rules|
subject = double
rules << mock_rule(:rule_1, is_applicable: false)
rules << mock_rule(:rule_2)
- custom_ruleset_klass = Class.new(StrongRuleset)
+ custom_ruleset_klass = Class.new(Patterns::StrongRuleset)
custom_ruleset_klass.add_rule(:rule_1)
custom_ruleset_klass.add_rule(:rule_2)
expect(custom_ruleset_klass.new(subject).applicable?).to eq false
end
@@ -51,10 +51,10 @@
end
private
def mock_rule(rule_name, is_applicable: true, is_satisfied: true, is_forceable: true)
- klass = Object.const_set(rule_name.to_s.classify, Class.new(Rule))
+ klass = Object.const_set(rule_name.to_s.classify, Class.new(Patterns::Rule))
rule = double(
not_applicable?: !is_applicable,
applicable?: is_applicable,
satisfied?: is_satisfied,
forceable?: is_forceable