Commit 509a4899 authored by Rajendra Kadam's avatar Rajendra Kadam

Move rails root join in the matcher

parent e1bd1bbc
...@@ -29,7 +29,7 @@ RSpec.describe SurveyResponsesController do ...@@ -29,7 +29,7 @@ RSpec.describe SurveyResponsesController do
context: [{ schema: described_class::SURVEY_RESPONSE_SCHEMA_URL, data: { response: 'bar', survey_id: 1 } }] context: [{ schema: described_class::SURVEY_RESPONSE_SCHEMA_URL, data: { response: 'bar', survey_id: 1 } }]
) )
match_snowplow_context_schema(schema_path: 'survey_response_schema', context: { :response => 'bar', :survey_id => 1, :instance_id => 2 } ) match_snowplow_context_schema(schema_path: 'survey_response_schema', context: { response: 'bar', survey_id: 1, instance_id: 2 } )
end end
end end
......
...@@ -13,7 +13,6 @@ module SchemaPath ...@@ -13,7 +13,6 @@ module SchemaPath
end end
Rails.root.join(dir.to_s, 'spec', "fixtures/api/schemas/#{schema}.json").to_s Rails.root.join(dir.to_s, 'spec', "fixtures/api/schemas/#{schema}.json").to_s
Rails.root.join(dir.to_s, 'spec', "fixtures/product_intelligence/#{schema}.json").to_s
end end
def self.validator(schema_path) def self.validator(schema_path)
...@@ -48,7 +47,7 @@ end ...@@ -48,7 +47,7 @@ end
RSpec::Matchers.define :match_snowplow_schema do |schema, dir: nil, **options| RSpec::Matchers.define :match_snowplow_schema do |schema, dir: nil, **options|
match do |data| match do |data|
schema_path = Pathname.new(SchemaPath.expand(schema, dir)) schema_path = Pathname.new(Rails.root.join(dir.to_s, 'spec', "fixtures/product_intelligence/#{schema}.json").to_s)
validator = SchemaPath.validator(schema_path) validator = SchemaPath.validator(schema_path)
validator.valid?(data.stringify_keys) validator.valid?(data.stringify_keys)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment