Module: Graphiti::SpecHelpers::RSpec
- Defined in:
- lib/graphiti/spec_helpers/rspec.rb
Class Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
121 122 123 124 125 126 127 128 |
# File 'lib/graphiti/spec_helpers/rspec.rb', line 121 def self.included(klass) klass.send(:include, Graphiti::SpecHelpers) ::RSpec.configure do |rspec| rspec.include_context "graphiti resource testing", type: :resource rspec.include Graphiti::SpecHelpers::Matchers, type: :resource end end |
.schema!(resources = nil, path: nil) ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/graphiti/spec_helpers/rspec.rb', line 130 def self.schema!(resources = nil, path: nil) ::RSpec.describe "Graphiti Schema" do it "generates a backwards-compatible schema" do check = Graphiti::Schema.check(resources, path: path || Graphiti.config.schema_path) forced = ENV["FORCE_SCHEMA"] == "true" check.write! if check.compatible? || forced expect(check.compatible? || forced).to eq(true), check. end end end |