rusty_engine 0.0.1 → 0.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
  SHA1:
3
- metadata.gz: 13b04164fed468cce406934f40c61cdb1a075693
4
- data.tar.gz: bf795daf215cd4152bc98987671b6389721ff311
3
+ metadata.gz: dcb6ba3c5cfed21ef661b2c8e628ca72e51fc430
4
+ data.tar.gz: e646e1522e70b23264074d2f4e4451c8ec1a5f5f
5
5
  SHA512:
6
- metadata.gz: 28306d5ef639217e6153f66bd67b53a705a6cb08874b672ec6aa72655c8f5dad648fd097294de0aa88a62486f57d519cf3d6a2f8bd659547f8e69c4c7ac80a59
7
- data.tar.gz: cd9a0ea17b50d8c17b11858c3e0aee6081fdd30a759a91b58904e4d1477d2edc2ce028c666e87a68b79f885ca1d9f19ca7b8a8756c563abd83bef8460450af9d
6
+ metadata.gz: 3feb835ec0a537f9beb45124a7294435784deb2a0846960898d8c9986ef88fe9962f7f2f8808c48205b707f0541b150e2e466c2b9a0aece26e9a7e7163030406
7
+ data.tar.gz: 0b144bb0970ad00eb1da21a7e233a4ea40054146d87a7a54929033c3d2030c9e59c319f9e4ab077eab87a7bb9fdc711e5693b21ca70f6d58549e1cad7bb116ac
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,18 @@
1
+ require_dependency "rusty_engine/application_controller"
2
+
3
+ module RustyEngine
4
+ class ApplicationController < ::ApplicationController
5
+ def index
6
+ if session[:user_id] = user.id
7
+ @conversation = Conversation.find(params[:conversation_last])
8
+ @messages = @conversation.messages
9
+ i = 0
10
+ begin
11
+ @messages[i]
12
+ i += 1
13
+ end until i > 2
14
+ end
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,4 @@
1
+ module RustyEngine
2
+ module RecentmessageHelper
3
+ end
4
+ end
@@ -0,0 +1,11 @@
1
+ module RustyEngine
2
+ class Recentmessages < ActiveRecord::Base
3
+ belongs_to :user
4
+ has_many :messages, dependent :destroy
5
+
6
+ def recent_message
7
+ scope :between, -> (sender_id, recipient_id) do
8
+ where("conversations.sender_id = ? OR conversations.recipient_id = ?", sender_id, recipient_id)
9
+ end
10
+ end
11
+ end
@@ -9,6 +9,6 @@
9
9
  <body>
10
10
 
11
11
  <%= yield %>
12
-
12
+ <p>HERE IS THE TEXT FROM RUSTY_ENGINE</p>
13
13
  </body>
14
14
  </html>
@@ -0,0 +1,15 @@
1
+ <div class="ui segment">
2
+ <h3>Recent Messages</h3>
3
+ <div class="ui list">
4
+ <div class="item">
5
+ <% @conversations.each do |conversation| %>
6
+ <% if conversation.sender_id == current_user.id || conversation.recipient_id == current_user.id %>
7
+ <% if conversation.sender_id == current_user.id %>
8
+ <% recipient = User.find(conversation.recipient_id) %>
9
+ <% else %>
10
+ <% recipient = User.find(coversation.send_id) %>
11
+ <% end %>
12
+ <% recipient.first_name, conversation.display %>
13
+ </div>
14
+ </div>
15
+ </div>
data/config/routes.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  RustyEngine::Engine.routes.draw do
2
- get 'failures/index'
2
+
3
+ root 'recentmessages#index'
3
4
 
5
+
4
6
  resources :profiles
5
- root :to => "profiles#index"
7
+
6
8
  end
@@ -0,0 +1,8 @@
1
+ class CreateRustyEngineRecentmessages < ActiveRecord::Migration
2
+ def change
3
+ create_table :rusty_engine_recentmessages do |t|
4
+
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ require 'test_helper'
2
+
3
+ module RustyEngine
4
+ class RecentmessageControllerTest < ActionController::TestCase
5
+ test "should get new" do
6
+ get :new
7
+ assert_response :success
8
+ end
9
+
10
+ test "should get create" do
11
+ get :create
12
+ assert_response :success
13
+ end
14
+
15
+ end
16
+ end
@@ -16,3 +16,104 @@ Started GET "/" for 127.0.0.1 at 2017-06-16 10:59:01 -0400
16
16
  Processing by Rails::WelcomeController#index as HTML
17
17
  Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (2.3ms)
18
18
  Completed 200 OK in 11ms (Views: 10.9ms | ActiveRecord: 0.0ms)
19
+
20
+
21
+ Started GET "/" for 127.0.0.1 at 2017-06-19 09:36:23 -0400
22
+ Processing by Rails::WelcomeController#index as HTML
23
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (3.0ms)
24
+ Completed 200 OK in 136ms (Views: 135.6ms | ActiveRecord: 0.0ms)
25
+
26
+
27
+ Started GET "/" for 127.0.0.1 at 2017-06-19 09:36:23 -0400
28
+ Processing by Rails::WelcomeController#index as HTML
29
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (0.1ms)
30
+ Completed 200 OK in 2ms (Views: 2.3ms | ActiveRecord: 0.0ms)
31
+
32
+
33
+ Started GET "/" for 127.0.0.1 at 2017-06-19 11:49:44 -0400
34
+ Processing by Rails::WelcomeController#index as HTML
35
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (2.0ms)
36
+ Completed 200 OK in 10ms (Views: 9.5ms | ActiveRecord: 0.0ms)
37
+
38
+
39
+ Started GET "/conversations/1/messages" for 127.0.0.1 at 2017-06-19 11:49:45 -0400
40
+
41
+ ActionController::RoutingError (No route matches [GET] "/conversations/1/messages"):
42
+ actionpack (4.1.16) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
43
+ actionpack (4.1.16) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
44
+ railties (4.1.16) lib/rails/rack/logger.rb:38:in `call_app'
45
+ railties (4.1.16) lib/rails/rack/logger.rb:20:in `block in call'
46
+ activesupport (4.1.16) lib/active_support/tagged_logging.rb:68:in `block in tagged'
47
+ activesupport (4.1.16) lib/active_support/tagged_logging.rb:26:in `tagged'
48
+ activesupport (4.1.16) lib/active_support/tagged_logging.rb:68:in `tagged'
49
+ railties (4.1.16) lib/rails/rack/logger.rb:20:in `call'
50
+ actionpack (4.1.16) lib/action_dispatch/middleware/request_id.rb:21:in `call'
51
+ rack (1.5.5) lib/rack/methodoverride.rb:21:in `call'
52
+ rack (1.5.5) lib/rack/runtime.rb:17:in `call'
53
+ activesupport (4.1.16) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
54
+ rack (1.5.5) lib/rack/lock.rb:17:in `call'
55
+ actionpack (4.1.16) lib/action_dispatch/middleware/static.rb:84:in `call'
56
+ rack (1.5.5) lib/rack/sendfile.rb:112:in `call'
57
+ railties (4.1.16) lib/rails/engine.rb:514:in `call'
58
+ railties (4.1.16) lib/rails/application.rb:144:in `call'
59
+ rack (1.5.5) lib/rack/lock.rb:17:in `call'
60
+ rack (1.5.5) lib/rack/content_length.rb:14:in `call'
61
+ rack (1.5.5) lib/rack/handler/webrick.rb:60:in `service'
62
+ /Users/stannajl/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
63
+ /Users/stannajl/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
64
+ /Users/stannajl/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
65
+
66
+
67
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/actionpack-4.1.16/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.5ms)
68
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/actionpack-4.1.16/lib/action_dispatch/middleware/templates/routes/_route.html.erb (1.0ms)
69
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/actionpack-4.1.16/lib/action_dispatch/middleware/templates/routes/_route.html.erb (1.1ms)
70
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/actionpack-4.1.16/lib/action_dispatch/middleware/templates/routes/_table.html.erb (8.1ms)
71
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/actionpack-4.1.16/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (110.5ms)
72
+
73
+
74
+ Started GET "/" for 127.0.0.1 at 2017-06-19 11:49:49 -0400
75
+ Processing by Rails::WelcomeController#index as HTML
76
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (0.1ms)
77
+ Completed 200 OK in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
78
+
79
+
80
+ Started GET "/" for 127.0.0.1 at 2017-06-19 11:50:41 -0400
81
+ Processing by Rails::WelcomeController#index as HTML
82
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (1.8ms)
83
+ Completed 200 OK in 15ms (Views: 15.2ms | ActiveRecord: 0.0ms)
84
+
85
+
86
+ Started GET "/" for 127.0.0.1 at 2017-06-19 11:54:11 -0400
87
+ Processing by Rails::WelcomeController#index as HTML
88
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (1.7ms)
89
+ Completed 200 OK in 15ms (Views: 15.0ms | ActiveRecord: 0.0ms)
90
+
91
+
92
+ Started GET "/" for 127.0.0.1 at 2017-06-19 12:01:58 -0400
93
+ Processing by Rails::WelcomeController#index as HTML
94
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (1.7ms)
95
+ Completed 200 OK in 15ms (Views: 15.0ms | ActiveRecord: 0.0ms)
96
+
97
+
98
+ Started GET "/" for 127.0.0.1 at 2017-06-19 12:02:04 -0400
99
+ Processing by Rails::WelcomeController#index as HTML
100
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (0.1ms)
101
+ Completed 200 OK in 2ms (Views: 2.4ms | ActiveRecord: 0.0ms)
102
+
103
+
104
+ Started GET "/" for 127.0.0.1 at 2017-06-19 13:08:10 -0400
105
+ Processing by Rails::WelcomeController#index as HTML
106
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (2.2ms)
107
+ Completed 200 OK in 17ms (Views: 17.0ms | ActiveRecord: 0.0ms)
108
+
109
+
110
+ Started GET "/" for 127.0.0.1 at 2017-06-19 13:10:18 -0400
111
+ Processing by Rails::WelcomeController#index as HTML
112
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (0.1ms)
113
+ Completed 200 OK in 2ms (Views: 2.3ms | ActiveRecord: 0.0ms)
114
+
115
+
116
+ Started GET "/" for 127.0.0.1 at 2017-06-19 13:11:29 -0400
117
+ Processing by Rails::WelcomeController#index as HTML
118
+ Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (1.8ms)
119
+ Completed 200 OK in 15ms (Views: 15.0ms | ActiveRecord: 0.0ms)
@@ -50,3 +50,11 @@ RustyEngine::FailuresControllerTest: test_should_get_index
50
50
  RustyEngineTest: test_truth
51
51
  ---------------------------
52
52
   (0.0ms) rollback transaction
53
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
54
+  (1.5ms) CREATE TABLE "rusty_engine_profiles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "text" text, "created_at" datetime, "updated_at" datetime) 
55
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
56
+  (1.2ms) select sqlite_version(*)
57
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
58
+  (0.1ms) SELECT version FROM "schema_migrations"
59
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20170615202658')
60
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,6 @@
1
+ require 'test_helper'
2
+
3
+ module RustyEngine
4
+ class RecentmessageHelperTest < ActionView::TestCase
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module RustyEngine
4
+ class RecentmessagesTest < ActiveSupport::TestCase
5
+ # test "the truth" do
6
+ # assert true
7
+ # end
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rusty_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
- - Joe Stannard
7
+ - JoeStannard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2017-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -51,28 +51,36 @@ files:
51
51
  - Rakefile
52
52
  - app/assets/javascripts/rusty_engine/application.js
53
53
  - app/assets/javascripts/rusty_engine/profiles.js
54
+ - app/assets/javascripts/rusty_engine/recentmessage.js
54
55
  - app/assets/stylesheets/rusty_engine/application.css
55
56
  - app/assets/stylesheets/rusty_engine/profiles.css
57
+ - app/assets/stylesheets/rusty_engine/recentmessage.css
56
58
  - app/assets/stylesheets/scaffold.css
57
59
  - app/controllers/rusty_engine/application_controller.rb
58
60
  - app/controllers/rusty_engine/profiles_controller.rb
61
+ - app/controllers/rusty_engine/recentmessage_controller.rb
59
62
  - app/helpers/rusty_engine/application_helper.rb
60
63
  - app/helpers/rusty_engine/failures_helper.rb
61
64
  - app/helpers/rusty_engine/profiles_helper.rb
65
+ - app/helpers/rusty_engine/recentmessage_helper.rb
62
66
  - app/models/rusty_engine/profile.rb
67
+ - app/models/rusty_engine/recentmessages.rb
63
68
  - app/views/layouts/rusty_engine/application.html.erb
64
69
  - app/views/rusty_engine/profiles/_form.html.erb
65
70
  - app/views/rusty_engine/profiles/edit.html.erb
66
71
  - app/views/rusty_engine/profiles/index.html.erb
67
72
  - app/views/rusty_engine/profiles/new.html.erb
68
73
  - app/views/rusty_engine/profiles/show.html.erb
74
+ - app/views/rusty_engine/recentmessage/index.html.erb
69
75
  - config/routes.rb
70
76
  - db/migrate/20170615202658_create_rusty_engine_profiles.rb
77
+ - db/migrate/20170616193639_create_rusty_engine_recentmessages.rb
71
78
  - lib/rusty_engine.rb
72
79
  - lib/rusty_engine/engine.rb
73
80
  - lib/rusty_engine/version.rb
74
81
  - lib/tasks/rusty_engine_tasks.rake
75
82
  - test/controllers/rusty_engine/profiles_controller_test.rb
83
+ - test/controllers/rusty_engine/recentmessage_controller_test.rb
76
84
  - test/dummy/README.rdoc
77
85
  - test/dummy/Rakefile
78
86
  - test/dummy/app/assets/javascripts/application.js
@@ -112,10 +120,13 @@ files:
112
120
  - test/dummy/public/500.html
113
121
  - test/dummy/public/favicon.ico
114
122
  - test/fixtures/rusty_engine/profiles.yml
123
+ - test/fixtures/rusty_engine/recentmessages.yml
115
124
  - test/helpers/rusty_engine/failures_helper_test.rb
116
125
  - test/helpers/rusty_engine/profiles_helper_test.rb
126
+ - test/helpers/rusty_engine/recentmessage_helper_test.rb
117
127
  - test/integration/navigation_test.rb
118
128
  - test/models/rusty_engine/profile_test.rb
129
+ - test/models/rusty_engine/recentmessages_test.rb
119
130
  - test/rusty_engine_test.rb
120
131
  - test/test_helper.rb
121
132
  homepage: https://github.com/rougehero/railsEngineTest.git
@@ -144,6 +155,7 @@ specification_version: 4
144
155
  summary: Testing how to implement engines
145
156
  test_files:
146
157
  - test/controllers/rusty_engine/profiles_controller_test.rb
158
+ - test/controllers/rusty_engine/recentmessage_controller_test.rb
147
159
  - test/dummy/app/assets/javascripts/application.js
148
160
  - test/dummy/app/assets/stylesheets/application.css
149
161
  - test/dummy/app/controllers/application_controller.rb
@@ -183,9 +195,12 @@ test_files:
183
195
  - test/dummy/Rakefile
184
196
  - test/dummy/README.rdoc
185
197
  - test/fixtures/rusty_engine/profiles.yml
198
+ - test/fixtures/rusty_engine/recentmessages.yml
186
199
  - test/helpers/rusty_engine/failures_helper_test.rb
187
200
  - test/helpers/rusty_engine/profiles_helper_test.rb
201
+ - test/helpers/rusty_engine/recentmessage_helper_test.rb
188
202
  - test/integration/navigation_test.rb
189
203
  - test/models/rusty_engine/profile_test.rb
204
+ - test/models/rusty_engine/recentmessages_test.rb
190
205
  - test/rusty_engine_test.rb
191
206
  - test/test_helper.rb