spec/spec_helper.rb in contentful_middleman-1.5.0 vs spec/spec_helper.rb in contentful_middleman-2.0.0
- old
+ new
@@ -1,21 +1,26 @@
+require 'simplecov'
+SimpleCov.start
+
$LOAD_PATH.unshift File.expand_path('lib', __FILE__)
require 'vcr'
require 'yaml'
require 'contentful_middleman'
require 'middleman-core'
+RSpec.configure do |config|
+ config.filter_run :focus => true
+ config.run_all_when_everything_filtered = true
+end
+
VCR.configure do |config|
config.cassette_library_dir = "spec/fixtures/vcr_fixtures"
config.hook_into :webmock
end
-require 'simplecov'
-SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/..'))
-
def vcr(cassette)
VCR.use_cassette(cassette) do
yield if block_given?
end
end
@@ -42,10 +47,11 @@
class OptionsDouble
DEFAULT_OPTIONS = {
space: {id: 'cfexampleapi', name: 'cats'},
access_token: 'b4c0n73n7fu1',
cda_query: {},
+ client_options: {},
content_types: {},
default_locale: 'en-US',
use_preview_api: false,
all_entries: false,
all_entries_page_size: 1000,
@@ -66,16 +72,25 @@
end
end
end
end
+class ContentTypeDouble
+ attr_reader :id
+
+ def initialize(id)
+ @id = id
+ end
+end
+
class EntryDouble
attr_reader :id, :sys, :fields
def initialize(id, sys_data = {}, fields = {}, updated_at = nil)
@id = id
sys_data[:id] = id
sys_data[:updated_at] = updated_at
+ sys_data[:content_type] = ContentTypeDouble.new("#{id}_ct")
@sys = sys_data
@fields = fields
unless fields.nil?
fields.each do |k, v|