azeroth 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60f05e09418f7fc0e6155ee3c4e7349e3a80638295eb01032dc0c284a5ccbaa5
4
- data.tar.gz: 97e333436d04d1cfb255c2dc26751e43aa9da6fad9a383f4c26de33c1df70ffe
3
+ metadata.gz: b37d53edb3f9b83aca0a7b121040c8db535da8b40d1bbc863c4d0b368dabe65d
4
+ data.tar.gz: 567d011f2f370e24d4b182182cfed7d08e46e344e533f6caccc1529c1c318643
5
5
  SHA512:
6
- metadata.gz: 2d01f8321b172c0f3d6aedde71ae3e34de04ba261bcacaa4f9157bf8223a75390378167dee429e704a67c38d9d8bb21e695d00faaf612b32dd09d2f53aff9927
7
- data.tar.gz: b73a0aee9cc39faff3f6e7a3281987028a27bee1034ecc22e0176e36bd8113fa784800d0460966e16fe973384e081112a74472c7e5878595a4156375b09d0ce2
6
+ metadata.gz: 8c89d250bf8825965909dcc57aac1adb333cc06995cc27e381a78a442fd3c0ce187d33f6b39b2f3a002eeb97e9ca5462a44d2f81ca957d3aa8810bd1441b8081
7
+ data.tar.gz: 0eb7564aa351c821bf88cf25d7ca3991eb239089b492dc31587526b437067f9436fdb175c86a7ca937fc457d76fb546e4c8cc5159236cc88145ed06ac215e3f6
data/.circleci/config.yml CHANGED
@@ -7,8 +7,12 @@ workflows:
7
7
  filters:
8
8
  tags:
9
9
  only: /.*/
10
+ - checks:
11
+ filters:
12
+ tags:
13
+ only: /.*/
10
14
  - build-and-release:
11
- requires: [test]
15
+ requires: [test, checks]
12
16
  filters:
13
17
  tags:
14
18
  only: /\d+\.\d+\.\d+/
@@ -18,7 +22,7 @@ workflows:
18
22
  jobs:
19
23
  test:
20
24
  docker:
21
- - image: darthjee/circleci_rails_gems:0.6.3
25
+ - image: darthjee/circleci_rails_gems:0.8.0
22
26
  environment:
23
27
  PROJECT: azeroth
24
28
  steps:
@@ -32,12 +36,22 @@ jobs:
32
36
  - run:
33
37
  name: RSpec
34
38
  command: bundle exec rspec
35
- - run:
36
- name: Rubocop
37
- command: rubocop
38
39
  - run:
39
40
  name: Coverage Test Report
40
41
  command: cc-test-reporter after-build --exit-code $?
42
+ checks:
43
+ docker:
44
+ - image: darthjee/circleci_rails_gems:0.8.0
45
+ environment:
46
+ PROJECT: azeroth
47
+ steps:
48
+ - checkout
49
+ - run:
50
+ name: Bundle Install
51
+ command: bundle install
52
+ - run:
53
+ name: Rubocop
54
+ command: rubocop
41
55
  - run:
42
56
  name: Yardstick coverage check
43
57
  command: bundle exec rake verify_measurements
@@ -52,7 +66,7 @@ jobs:
52
66
  command: check_specs
53
67
  build-and-release:
54
68
  docker:
55
- - image: darthjee/circleci_rails_gems:0.6.3
69
+ - image: darthjee/circleci_rails_gems:0.8.0
56
70
  environment:
57
71
  PROJECT: azeroth
58
72
  steps:
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM darthjee/rails_gems:0.7.0 as base
1
+ FROM darthjee/rails_gems:0.8.0 as base
2
2
  FROM darthjee/scripts:0.1.8 as scripts
3
3
 
4
4
  ######################################
data/README.md CHANGED
@@ -11,7 +11,7 @@ Azeroth
11
11
 
12
12
  Yard Documentation
13
13
  -------------------
14
- [https://www.rubydoc.info/gems/azeroth/0.8.1](https://www.rubydoc.info/gems/azeroth/0.8.1)
14
+ [https://www.rubydoc.info/gems/azeroth/0.8.2](https://www.rubydoc.info/gems/azeroth/0.8.2)
15
15
 
16
16
  Azeroth has been designed making the coding of controllers easier
17
17
  as routes in controllers are usually copy, paste and replace of same
data/azeroth.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |gem|
27
27
  gem.add_development_dependency 'activerecord', '~> 5.2.x'
28
28
  gem.add_development_dependency 'bundler', '1.16.1'
29
29
  gem.add_development_dependency 'factory_bot', '5.2.0'
30
- gem.add_development_dependency 'nokogiri', '1.11.4'
30
+ gem.add_development_dependency 'nokogiri', '1.12.5'
31
31
  gem.add_development_dependency 'pry', '0.12.2'
32
32
  gem.add_development_dependency 'pry-nav', '0.3.0'
33
33
  gem.add_development_dependency 'rails', '~> 5.2.x'
@@ -25,6 +25,7 @@ module Azeroth
25
25
  add_params
26
26
  add_resource
27
27
  add_routes
28
+ add_helpers
28
29
  end
29
30
 
30
31
  private
@@ -127,6 +128,14 @@ module Azeroth
127
128
  RoutesBuilder.new(model, builder, options).append
128
129
  end
129
130
 
131
+ # Add helpers to render objects on template
132
+ #
133
+ # @return [String]
134
+ def add_helpers
135
+ clazz.public_send(:helper_method, model.name)
136
+ clazz.public_send(:helper_method, model.plural)
137
+ end
138
+
130
139
  # Returns all updatable attributes
131
140
  #
132
141
  # @return [Array<String>]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Azeroth
4
- VERSION = '0.8.1'
4
+ VERSION = '0.8.2'
5
5
  end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe RenderingController do
6
+ let(:parsed_response) do
7
+ JSON.parse(response.body)
8
+ end
9
+
10
+ describe 'GET index' do
11
+ render_views
12
+
13
+ let(:documents_count) { Random.rand(2..5) }
14
+
15
+ let(:expected_content) do
16
+ documents.map do |document|
17
+ "<li><strong>Name:</strong>#{document.name}</li>"
18
+ end.join("\n ")
19
+ end
20
+
21
+ let!(:documents) { create_list(:document, documents_count) }
22
+
23
+ context 'when calling on format html' do
24
+ before do
25
+ get :index, params: { format: :html }
26
+ end
27
+
28
+ it { expect(response).to be_successful }
29
+
30
+ it { expect(response).to render_template('rendering/index') }
31
+
32
+ it { expect(response.body).to include(expected_content) }
33
+ end
34
+ end
35
+
36
+ describe 'GET show' do
37
+ render_views
38
+
39
+ let(:document) { create(:document) }
40
+ let(:document_id) { document.id }
41
+ let(:expected_content) do
42
+ "<p><strong>Name:</strong>#{document.name}</p>"
43
+ end
44
+
45
+ context 'when calling on format html' do
46
+ before do
47
+ get :show, params: { id: document.id, format: :html }
48
+ end
49
+
50
+ it { expect(response).to be_successful }
51
+
52
+ it { expect(response).to render_template('rendering/show') }
53
+
54
+ it { expect(response.body).to include(expected_content) }
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RenderingController < ApplicationController
4
+ include Azeroth::Resourceable
5
+
6
+ resource_for :document
7
+ end
@@ -0,0 +1,5 @@
1
+ <ul>
2
+ <% documents.each do |document| %>
3
+ <li><strong>Name:</strong><%= document.name %></li>
4
+ <% end %>
5
+ </ul>
@@ -0,0 +1 @@
1
+ <p><strong>Name:</strong><%= document.name %></p>
@@ -2,6 +2,7 @@
2
2
 
3
3
  Rails.application.routes.draw do
4
4
  resources :documents
5
+ resources :rendering
5
6
  resources :public_documents, controller: :index_documents
6
7
  resources :create_documents, controller: :documents_with_error
7
8
  resources :paginated_documents
@@ -67,5 +67,15 @@ describe Azeroth::RequestHandler do
67
67
  expect(controller).not_to have_received(:render)
68
68
  end
69
69
  end
70
+
71
+ context 'with format js' do
72
+ let(:format) { 'js' }
73
+
74
+ it do
75
+ handler.process
76
+
77
+ expect(controller).not_to have_received(:render)
78
+ end
79
+ end
70
80
  end
71
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azeroth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darthjee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-12 00:00:00.000000000 Z
11
+ date: 2021-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 1.11.4
131
+ version: 1.12.5
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 1.11.4
138
+ version: 1.12.5
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: pry
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -485,6 +485,7 @@ files:
485
485
  - spec/controllers/paginated_documents_controller_spec.rb
486
486
  - spec/controllers/pokemon_masters_controller_spec.rb
487
487
  - spec/controllers/pokemons_controller_spec.rb
488
+ - spec/controllers/rendering_controller_spec.rb
488
489
  - spec/dummy/.ruby-version
489
490
  - spec/dummy/Rakefile
490
491
  - spec/dummy/app/assets/config/manifest.js
@@ -505,6 +506,7 @@ files:
505
506
  - spec/dummy/app/controllers/pokemon_masters_controller.rb
506
507
  - spec/dummy/app/controllers/pokemons_controller.rb
507
508
  - spec/dummy/app/controllers/publishers_controller.rb
509
+ - spec/dummy/app/controllers/rendering_controller.rb
508
510
  - spec/dummy/app/helpers/application_helper.rb
509
511
  - spec/dummy/app/jobs/application_job.rb
510
512
  - spec/dummy/app/mailers/application_mailer.rb
@@ -538,6 +540,8 @@ files:
538
540
  - spec/dummy/app/views/layouts/application.html.erb
539
541
  - spec/dummy/app/views/layouts/mailer.html.erb
540
542
  - spec/dummy/app/views/layouts/mailer.text.erb
543
+ - spec/dummy/app/views/rendering/index.html.erb
544
+ - spec/dummy/app/views/rendering/show.html.erb
541
545
  - spec/dummy/bin/bundle
542
546
  - spec/dummy/bin/rails
543
547
  - spec/dummy/bin/rake
@@ -651,6 +655,7 @@ test_files:
651
655
  - spec/controllers/paginated_documents_controller_spec.rb
652
656
  - spec/controllers/pokemon_masters_controller_spec.rb
653
657
  - spec/controllers/pokemons_controller_spec.rb
658
+ - spec/controllers/rendering_controller_spec.rb
654
659
  - spec/dummy/.ruby-version
655
660
  - spec/dummy/Rakefile
656
661
  - spec/dummy/app/assets/config/manifest.js
@@ -671,6 +676,7 @@ test_files:
671
676
  - spec/dummy/app/controllers/pokemon_masters_controller.rb
672
677
  - spec/dummy/app/controllers/pokemons_controller.rb
673
678
  - spec/dummy/app/controllers/publishers_controller.rb
679
+ - spec/dummy/app/controllers/rendering_controller.rb
674
680
  - spec/dummy/app/helpers/application_helper.rb
675
681
  - spec/dummy/app/jobs/application_job.rb
676
682
  - spec/dummy/app/mailers/application_mailer.rb
@@ -704,6 +710,8 @@ test_files:
704
710
  - spec/dummy/app/views/layouts/application.html.erb
705
711
  - spec/dummy/app/views/layouts/mailer.html.erb
706
712
  - spec/dummy/app/views/layouts/mailer.text.erb
713
+ - spec/dummy/app/views/rendering/index.html.erb
714
+ - spec/dummy/app/views/rendering/show.html.erb
707
715
  - spec/dummy/bin/bundle
708
716
  - spec/dummy/bin/rails
709
717
  - spec/dummy/bin/rake