Skip to content

Commit

Permalink
Adopt new trailblazer-operation API
Browse files Browse the repository at this point in the history
  • Loading branch information
aldesantis committed Aug 25, 2019
1 parent d9f5b47 commit 373c693
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in pragma.gemspec
gemspec

gem 'pragma-operation', github: 'pragmarb/pragma-operation'
# gem 'pragma-operation', github: 'pragmarb/pragma-operation'
gem 'pragma-operation', path: '../pragma-operation'
gem 'pragma-policy', github: 'pragmarb/pragma-policy'
gem 'pragma-decorator', github: 'pragmarb/pragma-decorator'
gem 'pragma-contract', github: 'pragmarb/pragma-contract'
2 changes: 2 additions & 0 deletions lib/pragma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
require 'pragma/policy'
require 'pragma/contract'
require 'pragma/decorator'
require 'trailblazer-macro'
require 'trailblazer-macro-contract'
require 'zeitwerk'

Zeitwerk::Loader.for_gem.setup
Expand Down
3 changes: 2 additions & 1 deletion pragma.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Gem::Specification.new do |spec|
spec.add_dependency 'pragma-decorator', '~> 2.0'
spec.add_dependency 'pragma-operation', '~> 2.0'
spec.add_dependency 'pragma-policy', '~> 2.0'
spec.add_dependency 'trailblazer', '~> 2.0'
spec.add_dependency 'trailblazer-macro', '~> 2.1.0.rc13'
spec.add_dependency 'trailblazer-macro-contract', '~> 2.1.0.rc13'
spec.add_dependency 'zeitwerk', '~> 2.1'

spec.add_development_dependency 'bundler'
Expand Down
1 change: 1 addition & 0 deletions spec/pragma/macro/classes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class << self
def validate_classes(operation, expectations)
expectations.each do |key, expected|
it "computes #{key} correctly" do
binding.irb
expect(Object.const_get(operation).call[key].to_s).to eq(expected)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/pragma/operation/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RSpec.describe Pragma::Operation::Create do
subject(:result) do
described_class.call(
params,
'params' => params,
'current_user' => current_user,
'model.class' => model_klass,
'decorator.instance.class' => decorator_klass,
Expand Down
2 changes: 1 addition & 1 deletion spec/pragma/operation/destroy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RSpec.describe Pragma::Operation::Destroy do
subject(:result) do
described_class.call(
params,
'params' => params,
'current_user' => current_user,
'model.class' => model_klass,
'policy.default.class' => policy_klass
Expand Down
2 changes: 1 addition & 1 deletion spec/pragma/operation/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
RSpec.describe Pragma::Operation::Index do
subject(:result) do
described_class.call(
params,
'params' => params,
'current_user' => current_user,
'model.class' => model_klass,
'decorator.collection.class' => collection_decorator_klass,
Expand Down
4 changes: 3 additions & 1 deletion spec/pragma/operation/show_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

RSpec.describe Pragma::Operation::Show do
subject(:result) { described_class.call(params, base_options.merge(options)) }
subject(:result) do
described_class.call(base_options.merge(options).merge('params' => params))
end

let(:params) do
{
Expand Down
2 changes: 1 addition & 1 deletion spec/pragma/operation/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RSpec.describe Pragma::Operation::Update do
subject(:result) do
described_class.call(
params,
'params' => params,
'current_user' => current_user,
'model.class' => model_klass,
'decorator.instance.class' => decorator_klass,
Expand Down

0 comments on commit 373c693

Please sign in to comment.