ru.Bee 2.2.2 → 2.2.4

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: 30f14be70030e4b247ee3ff3557ce1a2fc4f376581308ea87e650ca983ed5e7a
4
+ data.tar.gz: 26d7aaa32737fdb7f1adfd0a7997d3e19e2a0a92020a47d7e421da9b30afa813
5
5
  SHA512:
6
- metadata.gz: 86961f349607ca22989c7d963c829c41e84e4fa9a6620198b4715444bf5dda83d8bf3fa25652cd4f6a32bbc7dfb20f9629efbf8baa61a530c45b3f7947b48aac
7
- data.tar.gz: af077aced4ecbc32d28c3d4c31069b7bc2740dfe969d043d6348461f6de7f9a72ee50b47d97719607295a0fa8096533e79d8cc8e98289db14d978a2d5dbcef89
6
+ metadata.gz: 87f0732e5180dfbc05cd844d2744830e2837f47e744463f1b863d84c23408686e5f15ed6ce1299abf245d28de5467668a9078a0431e0ba091fc51cbccc0578b3
7
+ data.tar.gz: 54d5164817758f5cac8d5a4aaf0029b26345da43c8a4d667ee33cf4f6317eaacbe0bdc49fc687ac0eccacf16423659495a0c50ab1fd630a038198a781baa6c79
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.4'
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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Saltykov