ru.Bee 2.2.2 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48d957ceb9eadc87893584969f6bb3fba784ed2f8d348acf8f7741bcfba1c345
4
- data.tar.gz: 01f3ec0459b20095934ff5848ddfee75be62a72cb80ce6bfb9c5bfa44ba3614c
3
+ metadata.gz: 4958166a93833b8937bd8fddff68db21fac7fe6c4b10c9f3ad41aa41c81342b6
4
+ data.tar.gz: 8317204f759ec29ec13aaaba6a6ceac200963298cfc07256f4d0b03cb249a1dc
5
5
  SHA512:
6
- metadata.gz: 86961f349607ca22989c7d963c829c41e84e4fa9a6620198b4715444bf5dda83d8bf3fa25652cd4f6a32bbc7dfb20f9629efbf8baa61a530c45b3f7947b48aac
7
- data.tar.gz: af077aced4ecbc32d28c3d4c31069b7bc2740dfe969d043d6348461f6de7f9a72ee50b47d97719607295a0fa8096533e79d8cc8e98289db14d978a2d5dbcef89
6
+ metadata.gz: 8d3e0faa28a8aa69cf8aa0727b290bd6888f52241dd87b8cb59b3c9e725331c6c80779cf79ff63a7e73e588e1663ab1d2d050842d5f7fdeeea3b8e50b3016bdb
7
+ data.tar.gz: e636773215ef25384a159b49024b1d965f3dbc1e5fff08b696779a7000637536e85e492dd6228bdd38f06757c6762bed59b9f8b42749dba1ebc674df05be1aa0
data/lib/inits/system.rb CHANGED
@@ -3,5 +3,3 @@ def reload
3
3
  app_files.each { |file| load(file) }
4
4
  puts "\e[32mReloaded..\e[0m"
5
5
  end
6
-
7
-
@@ -80,7 +80,7 @@ module Rubee
80
80
  react_app_file = <<~REACT_APP_FILE
81
81
  import React from 'react';
82
82
 
83
- export function #{new_app_name.camelize}App() {
83
+ export default function #{new_app_name.camelize}App() {
84
84
  return (
85
85
  <h1>#{new_app_name.camelize}App</h1>
86
86
  );
@@ -67,7 +67,7 @@ module Rubee
67
67
  in :unauthentificated
68
68
  [401, headers.merge('content-type' => 'text/plain'), ['Unauthentificated']]
69
69
  in :redirect
70
- [302, headers.merge('location' => to.to_s), ['Unauthentificated']]
70
+ [302, headers.merge('location' => to.to_s), []]
71
71
  in :not_found
72
72
  [404, { 'content-type' => 'text/plain' }, ['Route not found']]
73
73
  else # rendering erb view is a default behavior
@@ -6,6 +6,7 @@ module Rubee
6
6
  def initialize(model_name, model_attributes, controller_name, action_name, **options)
7
7
  @model_name = model_name&.downcase
8
8
  @model_attributes = model_attributes || []
9
+ @filtered_attributes = model_attributes.select { |attribute| !attribute[:name].include?('index') }
9
10
  @base_name = controller_name.to_s.gsub('Controller', '').downcase.to_s
10
11
  color_puts("base_name: #{@base_name}", color: :gray)
11
12
  @plural_name = @base_name.plural? ? @base_name : @base_name.pluralize
@@ -33,7 +34,7 @@ module Rubee
33
34
 
34
35
  content = <<~RUBY
35
36
  class #{@namespace}#{@model_name.camelize} < Rubee::SequelObject
36
- #{'attr_accessor ' + @model_attributes.map { |hash| ":#{hash[:name]}" }.join(', ') unless @model_attributes.empty?}
37
+ #{'attr_accessor ' + @filtered_attributes.map { |hash| ":#{hash[:name]}" }.join(', ') unless @filtered_attributes.empty?}
37
38
  end
38
39
  RUBY
39
40
 
data/lib/rubee.rb CHANGED
@@ -17,7 +17,7 @@ module Rubee
17
17
  CSS_DIR = File.join(APP_ROOT, LIB, 'css') unless defined?(CSS_DIR)
18
18
  ROOT_PATH = File.expand_path(File.join(__dir__, '..')) unless defined?(ROOT_PATH)
19
19
 
20
- VERSION = '2.2.2'
20
+ VERSION = '2.2.3'
21
21
 
22
22
  require_relative 'rubee/router'
23
23
  require_relative 'rubee/logger'
@@ -1,12 +1,29 @@
1
1
  require_relative '../test_helper'
2
2
 
3
- class WebSocketControllerTest < Minitest::Test
3
+ class TestRedirectController < Rubee::BaseController
4
+ def index
5
+ response_with(type: :redirect, to: '/test')
6
+ end
7
+
8
+ def test
9
+ response_with(type: :json, object: { ok: :ok })
10
+ end
11
+ end
12
+
13
+ class BaseControllerTest < Minitest::Test
4
14
  include Rack::Test::Methods
5
15
 
6
16
  def app
7
17
  Rubee::Application.instance
8
18
  end
9
19
 
20
+ def setup
21
+ Rubee::Router.draw do |route|
22
+ route.get('/test', to: 'test_redirect#test')
23
+ route.get('/index', to: 'test_redirect#index')
24
+ end
25
+ end
26
+
10
27
  def test_retrieve_image
11
28
  get('/images/rubee.svg')
12
29
 
@@ -20,4 +37,12 @@ class WebSocketControllerTest < Minitest::Test
20
37
  assert_equal(200, last_response.status, "Unexpected response: #{last_response.body}")
21
38
  assert_equal('Image not found', last_response.body, "Unexpected response: #{last_response.body}")
22
39
  end
40
+
41
+ def test_redirect
42
+ get('/index')
43
+
44
+ assert_equal(302, last_response.status)
45
+ assert_equal('/test', last_response.headers['Location'])
46
+ assert_equal('', last_response.body)
47
+ end
23
48
  end
data/lib/tests/test.db CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ru.Bee
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Saltykov
@@ -45,10 +45,8 @@ files:
45
45
  - lib/app/controllers/welcome_controller.rb
46
46
  - lib/app/models/user.rb
47
47
  - lib/app/views/App.tsx
48
- - lib/app/views/apples_.erb
49
48
  - lib/app/views/index.html
50
49
  - lib/app/views/layout.erb
51
- - lib/app/views/s_.erb
52
50
  - lib/app/views/utils/redirectToBackend.tsx
53
51
  - lib/app/views/welcome_header.erb
54
52
  - lib/app/views/welcome_show.erb
@@ -1 +0,0 @@
1
- <h1>apples_ View</h1>
data/lib/app/views/s_.erb DELETED
@@ -1 +0,0 @@
1
- <h1>s_ View</h1>