Skip to content

Commit

Permalink
Add frozen_string_literal magic comment to all specs
Browse files Browse the repository at this point in the history
  • Loading branch information
asaf schers committed Dec 1, 2017
1 parent 1d62dc5 commit 0d1c972
Show file tree
Hide file tree
Showing 25 changed files with 55 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Metrics/BlockLength:
ExcludedMethods: ['describe', 'context']
ExcludedMethods: ['describe', 'context']
AllCops:
TargetRubyVersion: 2.4
2 changes: 2 additions & 0 deletions lib/scoruby.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'scoruby/version'
require 'scoruby/models_factory'
require 'nokogiri'
Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/decision.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Scoruby
class Decision

Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/features.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Scoruby
class Features

Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/models/decision_tree.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'scoruby/node'

module Scoruby
Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/models/gbm.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'scoruby/models/decision_tree'
require 'scoruby/features'

Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/models/naive_bayes/model.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'scoruby/models/naive_bayes/model_data'
require 'forwardable'

Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/models/naive_bayes/model_data.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Scoruby
module Models
module NaiveBayes
Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/models/random_forest.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Scoruby
module Models
class RandomForest
Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/models_factory.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'scoruby/models/decision_tree'
require 'scoruby/models/gbm'
require 'scoruby/models/random_forest'
Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/node.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'scoruby/predicate_factory'
require 'scoruby/decision'

Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/predicate_factory.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'scoruby/predicates/compound_predicate'
require 'scoruby/predicates/simple_predicate'
require 'scoruby/predicates/simple_set_predicate'
Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/predicates/compound_predicate.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Scoruby
module Predicates
class CompoundPredicate
Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/predicates/false_predicate.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Scoruby
module Predicates
class FalsePredicate
Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/predicates/simple_predicate.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Scoruby
module Predicates
class SimplePredicate
Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/predicates/simple_set_predicate.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Scoruby
module Predicates
class SimpleSetPredicate
Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/predicates/true_predicate.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Scoruby
module Predicates
class TruePredicate
Expand Down
2 changes: 2 additions & 0 deletions lib/scoruby/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Scoruby
VERSION = '0.2.7'
end
9 changes: 6 additions & 3 deletions spec/scoruby/models/naive_bayes/naive_bayes_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'
require 'scoruby/models/naive_bayes/model'

Expand All @@ -6,13 +8,14 @@
let(:naive_bayes_file) { 'spec/fixtures/naive_bayes.pmml'}
let(:xml) { Scoruby.xml_from_file_path(naive_bayes_file) }
let(:naive_bayes) { described_class.new(xml) }
let(:features) do {
let(:features) do
{
'age of individual': '24',
'gender': 'male',
'no of claims': '2',
'domicile': nil,
'age of car': '1'
}
}
end

let(:l0) { 8723 * 0.001 * 4273/8598 * 225/8561 * 830/8008 }
Expand All @@ -35,4 +38,4 @@
it 'scores by http://dmg.org/pmml/v4-2-1/NaiveBayes.html' do
expect(l2_probability).to be_within(0.0001).of (l2 / (l0 + l1 + l2 + l3 + l4))
end
end
end
2 changes: 2 additions & 0 deletions spec/scoruby/models/random_forest_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe Scoruby::Models::RandomForest do
Expand Down
2 changes: 2 additions & 0 deletions spec/scoruby/predicates/compound_predicate_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe Scoruby::Predicates::CompoundPredicate do
Expand Down
2 changes: 2 additions & 0 deletions spec/scoruby/predicates/simple_predicate_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe Scoruby::Predicates::SimplePredicate do
Expand Down
2 changes: 2 additions & 0 deletions spec/scoruby/predicates/simple_set_predicate_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe Scoruby::Predicates::SimpleSetPredicate do
Expand Down
2 changes: 2 additions & 0 deletions spec/scoruby/scoruby_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe Scoruby do
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'coveralls'
Coveralls.wear!

Expand Down

0 comments on commit 0d1c972

Please sign in to comment.