diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 8e3ede95..bd9018fb 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -35,6 +35,7 @@ //= require BSBMaterial/demo.js //= require custom.js //= require jquery-fileupload/basic +//= require induties/induties.js $(document).ready(function() { $('.count-to').countTo(); diff --git a/app/assets/javascripts/induties/assign_in_duties.coffee b/app/assets/javascripts/induties/assign_in_duties.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/induties/assign_in_duties.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/induties/induties.js b/app/assets/javascripts/induties/induties.js new file mode 100644 index 00000000..e69de29b diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 5b0c6845..e0308d12 100755 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -11,6 +11,7 @@ @import "BSBMaterial/style"; @import "BSBMaterial/themes/all-themes"; @import "reset"; +@import "induties/assign_in_duties"; /*@import "bootstrap-select/css/bootstrap-select.min";*/ diff --git a/app/assets/stylesheets/induties/assign_in_duties.scss b/app/assets/stylesheets/induties/assign_in_duties.scss new file mode 100644 index 00000000..8534da8e --- /dev/null +++ b/app/assets/stylesheets/induties/assign_in_duties.scss @@ -0,0 +1,92 @@ +// Place all the styles related to the induties/assign_in_duties controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ + +.custom-card-head{ + height: 40px; + background-color: grey; + color :#fff; + opacity: 0.8; + padding:5px; + font-weight:400; + align-items: center; +} +.form-group .form-control { + width: 100%; + border: none; + box-shadow: none; + -webkit-border-radius: 0; + -moz-border-radius: 0; + -ms-border-radius: 0; + border-radius: 0; + padding-left: 0; +} +.radio-room{ + margin-right:2rem; +} +.radio-table{ + margin-left:1rem; +} +.bmd-form-group { + position: relative; + padding-top: 0 !important; +} +.btn_create_induty{ + display: inline; + padding: 1.5rem; + margin: 0; +} +.create_induty_card{ + min-height:500px; +} + +#save_induties_by_name{ + -webkit-appearance: none; +} + +.checkboxLabel:before{ + content: '\e40c'; + font-family: "Material Icons"; + font-size: 25px; + vertical-align: middle; + margin-right: 5px; + color: #2196F3; +} + +#save_induties_by_name:checked ~ .checkboxLabel:before{ + content: '\e86c'; +} +.checkboxLabel { + font-size: 18px !important; +} +.add_more{ + content: '\e40c'; + font-family: "Material Icons"; + font-size: 25px; + vertical-align: middle; + margin-right: 5px; + color: #2196F3; +} +.success-msg { + color: #270; + background-color: #DFF2BF; + margin: 10px 0; + padding: 10px; + border-radius: 3px 3px 3px 3px; + display: none; + margin-right: 0.5rem; + margin-left: 0.5rem; +} +.show_all_commissioner_card{ + min-height: 790px; + max-height: 790px; + overflow: scroll; +} +.sweet-alert p { + font-size: 14px !important; + font-weight:bold; +} +.sweet-alert { + top :0; + margin-top: 20px !important; +} \ No newline at end of file diff --git a/app/controllers/induties/assign_in_duties_controller.rb b/app/controllers/induties/assign_in_duties_controller.rb new file mode 100644 index 00000000..b3c4179a --- /dev/null +++ b/app/controllers/induties/assign_in_duties_controller.rb @@ -0,0 +1,54 @@ +class Induties::AssignInDutiesController < ApplicationController + def index + @commissioners=Commissioner.active.all.order(created_at: :desc) + @booking_id = params[:booking_id] + end + + def get_all_occupied_dining + commissionerIds =params[:id] + @check_in_commissioner =InDuty.select("in_duties.*,dining_facilities.type as dinning_type") + .joins(" LEFT JOIN dining_facilities on dining_facilities.id = in_duties.dinning_id").where('commissioner_ids =? and out_time is null', commissionerIds); + # Rails.logger.info(@check_in_commissioner.to_json) + respond_to do |format| + format.json { render json: @check_in_commissioner.to_json } + end + end + def induties_create + commissioner_ids =params[:commissionerId] + booking_id =params[:booking_id] + dinning_id = params[:dinning_id] + induty = InDuty.new + induty.dinning_id = dinning_id + induty.booking_id = booking_id + induty.commissioner_ids = commissioner_ids + induty.by_name = params[:by_name] + induty.in_time = Time.now + if induty.save + dinning = DiningFacility.find(induty.dinning_id) + @induty= {"id"=>induty.id, + "dinning_id"=>induty.dinning_id, + "in_time"=>induty.in_time, + "out_time"=>induty.out_time, + "dinning_type"=>dinning.type } + respond_to do |format| + format.json { render json: @induty.to_json } + end + end + end + def induties_checkout + induty_id = params[:induty_id] + induty = InDuty.find(induty_id) + induty.out_time = Time.now + induty.save + @induty =induty + respond_to do |format| + format.json { render json: @induty.to_json } + end + end + def induties_remove + induty_id = params[:induty_id] + induty = InDuty.find(induty_id) + induty.destroy + end + +end diff --git a/app/controllers/settings/commissioners_controller.rb b/app/controllers/settings/commissioners_controller.rb index fb8c1993..bbaa1ca8 100755 --- a/app/controllers/settings/commissioners_controller.rb +++ b/app/controllers/settings/commissioners_controller.rb @@ -18,6 +18,7 @@ class Settings::CommissionersController < ApplicationController def new @commissioner = Commissioner.new @employee = Employee.all.order('name asc') + end # GET /commissioners/1/edit @@ -35,14 +36,21 @@ class Settings::CommissionersController < ApplicationController unless @commissioner.resigned_date.nil? @commissioner.resigned_date = @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d') end - respond_to do |format| - if @commissioner.save - format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully created.'} - format.json {render :show, status: :created, location: @commissioner} - else - format.html {render :new} - format.json {render json: @commissioner.errors, status: :unprocessable_entity} + # puts params[:from_induty].length + if (params[:from_induty] != "true") + respond_to do |format| + if @commissioner.save + format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully created.'} + format.json {render :show, status: :created, location: @commissioner} + else + format.html {render :new} + format.json {render json: @commissioner.errors, status: :unprocessable_entity} + end end + else + @commissioner.save + flash[:notice] = 'Commissioner was successfully created.' + redirect_to induties_assign_in_duties_path(params[:booking_id]) end end diff --git a/app/helpers/induties/assign_in_duties_helper.rb b/app/helpers/induties/assign_in_duties_helper.rb new file mode 100644 index 00000000..bb55d3b4 --- /dev/null +++ b/app/helpers/induties/assign_in_duties_helper.rb @@ -0,0 +1,2 @@ +module Induties::AssignInDutiesHelper +end diff --git a/app/models/induties.rb b/app/models/induties.rb new file mode 100644 index 00000000..a283db36 --- /dev/null +++ b/app/models/induties.rb @@ -0,0 +1,5 @@ +module Induties + def self.table_name_prefix + 'induties_' + end +end diff --git a/app/models/induties/assign_in_duty.rb b/app/models/induties/assign_in_duty.rb new file mode 100644 index 00000000..3d63dd05 --- /dev/null +++ b/app/models/induties/assign_in_duty.rb @@ -0,0 +1,2 @@ +class Induties::AssignInDuty < ApplicationRecord +end diff --git a/app/views/induties/assign_in_duties/_form.html.erb b/app/views/induties/assign_in_duties/_form.html.erb new file mode 100644 index 00000000..513d93a4 --- /dev/null +++ b/app/views/induties/assign_in_duties/_form.html.erb @@ -0,0 +1,10 @@ +<%= simple_form_for(@induties_assign_in_duty) do |f| %> + <%= f.error_notification %> + +
+
+ +
+ <%= f.button :submit %> +
+<% end %> diff --git a/app/views/induties/assign_in_duties/_induties_assign_in_duty.json.jbuilder b/app/views/induties/assign_in_duties/_induties_assign_in_duty.json.jbuilder new file mode 100644 index 00000000..4ad02170 --- /dev/null +++ b/app/views/induties/assign_in_duties/_induties_assign_in_duty.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! induties_assign_in_duty, :id, :created_at, :updated_at +json.url induties_assign_in_duty_url(induties_assign_in_duty, format: :json) diff --git a/app/views/induties/assign_in_duties/edit.html.erb b/app/views/induties/assign_in_duties/edit.html.erb new file mode 100644 index 00000000..63e24a52 --- /dev/null +++ b/app/views/induties/assign_in_duties/edit.html.erb @@ -0,0 +1,6 @@ +

Editing Induties Assign In Duty

+ +<%= render 'form', induties_assign_in_duty: @induties_assign_in_duty %> + +<%= link_to 'Show', @induties_assign_in_duty %> | +<%= link_to 'Back', induties_assign_in_duties_path %> diff --git a/app/views/induties/assign_in_duties/index.html.erb b/app/views/induties/assign_in_duties/index.html.erb new file mode 100644 index 00000000..15f3cf08 --- /dev/null +++ b/app/views/induties/assign_in_duties/index.html.erb @@ -0,0 +1,306 @@ + +
+
+
+
+ <% @commissioners.each do |com| %> +
+
+
+
<%=com.name %> +
+
+
+ +
+
+
+ <% end %> +
+
+
+ add +
+
+
+
+
+
+
+
+ +
+
+
+
+ + +
+ + + + + + + + + + +
DiningCheck In AtAction
+
+
+
+
+
+
+ + +
+
+
+
+ <%= simple_form_for 'zone', :method => :get do |f| %> + <%= f.collection_select :dinning_id, Room.all, :id, :name, {prompt: 'Select Room'},:class=>'form-control',:required => true %> + <%end %> +
+
+
+
+ <%= simple_form_for 'zone_t', :method => :get do |f| %> + <%= f.collection_select :dinning_id, Table.all, :id, :name, {prompt: 'Select Table'},:class=>'form-control',:required => true %> + <%end %> +
+
+
+
+
+
+ <%= simple_form_for 'save_induties', :url => induties_induties_create_path, :method => :post do |f| %> + <%= f.check_box :by_name,:class=>'form-control'%> + + <% end %> +
+
+ Create In Duty +
+
+ +
+ + diff --git a/app/views/induties/assign_in_duties/index.json.jbuilder b/app/views/induties/assign_in_duties/index.json.jbuilder new file mode 100644 index 00000000..057eb2db --- /dev/null +++ b/app/views/induties/assign_in_duties/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @induties_assign_in_duties, partial: 'induties_assign_in_duties/induties_assign_in_duty', as: :induties_assign_in_duty diff --git a/app/views/induties/assign_in_duties/new.html.erb b/app/views/induties/assign_in_duties/new.html.erb new file mode 100644 index 00000000..512f3038 --- /dev/null +++ b/app/views/induties/assign_in_duties/new.html.erb @@ -0,0 +1,5 @@ +

New Induties Assign In Duty

+ +<%= render 'form', induties_assign_in_duty: @induties_assign_in_duty %> + +<%= link_to 'Back', induties_assign_in_duties_path %> diff --git a/app/views/induties/assign_in_duties/show.html.erb b/app/views/induties/assign_in_duties/show.html.erb new file mode 100644 index 00000000..82a22e22 --- /dev/null +++ b/app/views/induties/assign_in_duties/show.html.erb @@ -0,0 +1,4 @@ +

<%= notice %>

+ +<%= link_to 'Edit', edit_induties_assign_in_duty_path(@induties_assign_in_duty) %> | +<%= link_to 'Back', induties_assign_in_duties_path %> diff --git a/app/views/induties/assign_in_duties/show.json.jbuilder b/app/views/induties/assign_in_duties/show.json.jbuilder new file mode 100644 index 00000000..0367be23 --- /dev/null +++ b/app/views/induties/assign_in_duties/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "induties_assign_in_duties/induties_assign_in_duty", induties_assign_in_duty: @induties_assign_in_duty diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index f508e4f3..c9688f06 100755 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -219,6 +219,7 @@ getCreditSales("","","cashier"); //credit sales script data binding $(".tables").on('click', function(){ + localStorage.setItem('dinning_type','table'); var dining_id = $(this).attr("data-id"); window.location.href = '/origami/table/' + dining_id; }); @@ -229,6 +230,7 @@ }); $(".rooms").on('click', function(){ + localStorage.setItem('dinning_type','room'); var dining_id = $(this).attr("data-id"); window.location.href = '/origami/room/' + dining_id; }); diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index f314d0ee..9c2a28b1 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -825,7 +825,7 @@ window.location.href = '/origami/table/' + dining_id + "/table_invoice/" + sale_id; }) $(".tables").on('click', function () { - + localStorage.setItem('dinning_type','table'); var customer_id = $(".customer-id").text(); show_customer_details(customer_id); @@ -843,7 +843,7 @@ }); $(".rooms").on('click', function () { - + localStorage.setItem('dinning_type','room'); var customer_id = $(".customer-id").text(); show_customer_details(customer_id); @@ -1207,9 +1207,10 @@ }); $('#in_duties').on('click', function () { + localStorage.setItem('dinning_id',<%= @dining.id %>); var dining_id = "<%= @dining.id %>"; var booking_id = "<%= @booking.booking_id rescue "" %>"; - window.location.href = '/origami/assign_in_duty/'+ booking_id; + window.location.href = '/induties/'+ booking_id +'/assign'; }); $('#void').on('click', function () { diff --git a/app/views/origami/in_duties/index_in_duty.html.erb b/app/views/origami/in_duties/index_in_duty.html.erb index 3f036186..cfdd28fc 100755 --- a/app/views/origami/in_duties/index_in_duty.html.erb +++ b/app/views/origami/in_duties/index_in_duty.html.erb @@ -1,9 +1,6 @@
-
-
-
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index f90729c9..80e66137 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -914,6 +914,7 @@ $(document).ready(function(){ show_customer_details(customer_id); var dining_id = $(this).attr("data-id"); + localStorage.setItem('dinning_type','table'); window.location.href = '/origami/table/' + dining_id; }); @@ -932,6 +933,7 @@ $(document).ready(function(){ show_customer_details(customer_id); var dining_id = $(this).attr("data-id"); + localStorage.setItem('dinning_type','room'); window.location.href = '/origami/room/' + dining_id; }); @@ -1367,9 +1369,10 @@ $('#add_invoice').on('click',function(){ }); $('#in_duties').on('click', function () { + localStorage.setItem('dinning_id',<%= @room.id %>); var dining_id = "<%= @room.id %>"; var booking_id = "<%= @booking.booking_id rescue "" %>"; - window.location.href = '/origami/assign_in_duty/'+ booking_id; + window.location.href = '/induties/'+ booking_id +'/assign'; }); // Ordering diff --git a/app/views/settings/commissioners/_form.html.erb b/app/views/settings/commissioners/_form.html.erb index 1d0823a5..85981077 100755 --- a/app/views/settings/commissioners/_form.html.erb +++ b/app/views/settings/commissioners/_form.html.erb @@ -36,6 +36,8 @@ <%= f.label :resigned_date %>
<%= f.text_field :resigned_date, {class: 'form-control datepicker', id: 'resigned_date', readonly: true} %>
<%= f.input :is_active %> + +
@@ -70,3 +72,7 @@
+ diff --git a/app/views/settings/commissioners/new.html.erb b/app/views/settings/commissioners/new.html.erb index 8d989cfb..23480fb9 100755 --- a/app/views/settings/commissioners/new.html.erb +++ b/app/views/settings/commissioners/new.html.erb @@ -10,3 +10,4 @@
<%= render 'form', commissioner: @commissioner %> + diff --git a/config/puma.rb b/config/puma.rb index fd89392f..6a545bed 100755 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,10 +1,10 @@ -application_path="#{File.expand_path("../..", __FILE__)}" -directory application_path -#environment ENV.fetch("RAILS_ENV") { "production" } -environment "production" -pidfile "#{application_path}/tmp/puma/pid" -state_path "#{application_path}/tmp/puma/state" -stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" -port ENV.fetch("PORT") { 62158 } -workers 2 -preload_app! +# application_path="#{File.expand_path("../..", __FILE__)}" +# directory application_path +# #environment ENV.fetch("RAILS_ENV") { "production" } +# environment "production" +# pidfile "#{application_path}/tmp/puma/pid" +# state_path "#{application_path}/tmp/puma/state" +# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" +# port ENV.fetch("PORT") { 62158 } +# workers 2 +# preload_app! diff --git a/config/routes.rb b/config/routes.rb index 57f0f51c..cff21feb 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,6 +2,14 @@ require 'sidekiq/web' Rails.application.routes.draw do + namespace :induties do + # resources :assign_in_duties + get ':booking_id/assign' => 'assign_in_duties#index', as: :assign_in_duties + get "/assign_in_duties/get_all_occupied_dining/:id" =>'assign_in_duties#get_all_occupied_dining', as: :get_all_occupied_dining + post ':booking_id/assign_create' => 'assign_in_duties#induties_create', as: :induties_create + post ':booking_id/assign_checkout/:induty_id' => 'assign_in_duties#induties_checkout', as: :induties_checkout + delete ':booking_id/assign_remove/:induty_id' => 'assign_in_duties#induties_remove', as: :induties_remove + end scope "(:locale)", locale: /en|mm/ do root 'home#index' mount Sidekiq::Web => '/kiq' diff --git a/db/migrate/20190617072833_add_byname_to_induties.rb b/db/migrate/20190617072833_add_byname_to_induties.rb new file mode 100644 index 00000000..04247dbb --- /dev/null +++ b/db/migrate/20190617072833_add_byname_to_induties.rb @@ -0,0 +1,5 @@ +class AddBynameToInduties < ActiveRecord::Migration[5.1] + def change + add_column :in_duties, :by_name, :boolean, default: false + end +end diff --git a/spec/controllers/induties/assign_in_duties_controller_spec.rb b/spec/controllers/induties/assign_in_duties_controller_spec.rb new file mode 100644 index 00000000..41a1df6a --- /dev/null +++ b/spec/controllers/induties/assign_in_duties_controller_spec.rb @@ -0,0 +1,141 @@ +require 'rails_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. +# +# Also compared to earlier versions of this generator, there are no longer any +# expectations of assigns and templates rendered. These features have been +# removed from Rails core in Rails 5, but can be added back in via the +# `rails-controller-testing` gem. + +RSpec.describe Induties::AssignInDutiesController, type: :controller do + + # This should return the minimal set of attributes required to create a valid + # Induties::AssignInDuty. As you add validations to Induties::AssignInDuty, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { + skip("Add a hash of attributes valid for your model") + } + + let(:invalid_attributes) { + skip("Add a hash of attributes invalid for your model") + } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # Induties::AssignInDutiesController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET #index" do + it "returns a success response" do + assign_in_duty = Induties::AssignInDuty.create! valid_attributes + get :index, params: {}, session: valid_session + expect(response).to be_success + end + end + + describe "GET #show" do + it "returns a success response" do + assign_in_duty = Induties::AssignInDuty.create! valid_attributes + get :show, params: {id: assign_in_duty.to_param}, session: valid_session + expect(response).to be_success + end + end + + describe "GET #new" do + it "returns a success response" do + get :new, params: {}, session: valid_session + expect(response).to be_success + end + end + + describe "GET #edit" do + it "returns a success response" do + assign_in_duty = Induties::AssignInDuty.create! valid_attributes + get :edit, params: {id: assign_in_duty.to_param}, session: valid_session + expect(response).to be_success + end + end + + describe "POST #create" do + context "with valid params" do + it "creates a new Induties::AssignInDuty" do + expect { + post :create, params: {induties_assign_in_duty: valid_attributes}, session: valid_session + }.to change(Induties::AssignInDuty, :count).by(1) + end + + it "redirects to the created induties_assign_in_duty" do + post :create, params: {induties_assign_in_duty: valid_attributes}, session: valid_session + expect(response).to redirect_to(Induties::AssignInDuty.last) + end + end + + context "with invalid params" do + it "returns a success response (i.e. to display the 'new' template)" do + post :create, params: {induties_assign_in_duty: invalid_attributes}, session: valid_session + expect(response).to be_success + end + end + end + + describe "PUT #update" do + context "with valid params" do + let(:new_attributes) { + skip("Add a hash of attributes valid for your model") + } + + it "updates the requested induties_assign_in_duty" do + assign_in_duty = Induties::AssignInDuty.create! valid_attributes + put :update, params: {id: assign_in_duty.to_param, induties_assign_in_duty: new_attributes}, session: valid_session + assign_in_duty.reload + skip("Add assertions for updated state") + end + + it "redirects to the induties_assign_in_duty" do + assign_in_duty = Induties::AssignInDuty.create! valid_attributes + put :update, params: {id: assign_in_duty.to_param, induties_assign_in_duty: valid_attributes}, session: valid_session + expect(response).to redirect_to(assign_in_duty) + end + end + + context "with invalid params" do + it "returns a success response (i.e. to display the 'edit' template)" do + assign_in_duty = Induties::AssignInDuty.create! valid_attributes + put :update, params: {id: assign_in_duty.to_param, induties_assign_in_duty: invalid_attributes}, session: valid_session + expect(response).to be_success + end + end + end + + describe "DELETE #destroy" do + it "destroys the requested induties_assign_in_duty" do + assign_in_duty = Induties::AssignInDuty.create! valid_attributes + expect { + delete :destroy, params: {id: assign_in_duty.to_param}, session: valid_session + }.to change(Induties::AssignInDuty, :count).by(-1) + end + + it "redirects to the induties_assign_in_duties list" do + assign_in_duty = Induties::AssignInDuty.create! valid_attributes + delete :destroy, params: {id: assign_in_duty.to_param}, session: valid_session + expect(response).to redirect_to(induties_assign_in_duties_url) + end + end + +end diff --git a/spec/helpers/induties/assign_in_duties_helper_spec.rb b/spec/helpers/induties/assign_in_duties_helper_spec.rb new file mode 100644 index 00000000..15eca0b4 --- /dev/null +++ b/spec/helpers/induties/assign_in_duties_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the Induties::AssignInDutiesHelper. For example: +# +# describe Induties::AssignInDutiesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe Induties::AssignInDutiesHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/induties/assign_in_duty_spec.rb b/spec/models/induties/assign_in_duty_spec.rb new file mode 100644 index 00000000..00feb9d7 --- /dev/null +++ b/spec/models/induties/assign_in_duty_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Induties::AssignInDuty, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/requests/induties/induties_assign_in_duties_spec.rb b/spec/requests/induties/induties_assign_in_duties_spec.rb new file mode 100644 index 00000000..15a7a48e --- /dev/null +++ b/spec/requests/induties/induties_assign_in_duties_spec.rb @@ -0,0 +1,10 @@ +require 'rails_helper' + +RSpec.describe "Induties::AssignInDuties", type: :request do + describe "GET /induties_assign_in_duties" do + it "works! (now write some real specs)" do + get induties_assign_in_duties_path + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/routing/induties/assign_in_duties_routing_spec.rb b/spec/routing/induties/assign_in_duties_routing_spec.rb new file mode 100644 index 00000000..97c119a3 --- /dev/null +++ b/spec/routing/induties/assign_in_duties_routing_spec.rb @@ -0,0 +1,39 @@ +require "rails_helper" + +RSpec.describe Induties::AssignInDutiesController, type: :routing do + describe "routing" do + + it "routes to #index" do + expect(:get => "/induties/assign_in_duties").to route_to("induties/assign_in_duties#index") + end + + it "routes to #new" do + expect(:get => "/induties/assign_in_duties/new").to route_to("induties/assign_in_duties#new") + end + + it "routes to #show" do + expect(:get => "/induties/assign_in_duties/1").to route_to("induties/assign_in_duties#show", :id => "1") + end + + it "routes to #edit" do + expect(:get => "/induties/assign_in_duties/1/edit").to route_to("induties/assign_in_duties#edit", :id => "1") + end + + it "routes to #create" do + expect(:post => "/induties/assign_in_duties").to route_to("induties/assign_in_duties#create") + end + + it "routes to #update via PUT" do + expect(:put => "/induties/assign_in_duties/1").to route_to("induties/assign_in_duties#update", :id => "1") + end + + it "routes to #update via PATCH" do + expect(:patch => "/induties/assign_in_duties/1").to route_to("induties/assign_in_duties#update", :id => "1") + end + + it "routes to #destroy" do + expect(:delete => "/induties/assign_in_duties/1").to route_to("induties/assign_in_duties#destroy", :id => "1") + end + + end +end diff --git a/spec/views/induties/assign_in_duties/edit.html.erb_spec.rb b/spec/views/induties/assign_in_duties/edit.html.erb_spec.rb new file mode 100644 index 00000000..e6029a67 --- /dev/null +++ b/spec/views/induties/assign_in_duties/edit.html.erb_spec.rb @@ -0,0 +1,14 @@ +require 'rails_helper' + +RSpec.describe "induties/assign_in_duties/edit", type: :view do + before(:each) do + @induties_assign_in_duty = assign(:induties_assign_in_duty, Induties::AssignInDuty.create!()) + end + + it "renders the edit induties_assign_in_duty form" do + render + + assert_select "form[action=?][method=?]", induties_assign_in_duty_path(@induties_assign_in_duty), "post" do + end + end +end diff --git a/spec/views/induties/assign_in_duties/index.html.erb_spec.rb b/spec/views/induties/assign_in_duties/index.html.erb_spec.rb new file mode 100644 index 00000000..7fd74daf --- /dev/null +++ b/spec/views/induties/assign_in_duties/index.html.erb_spec.rb @@ -0,0 +1,14 @@ +require 'rails_helper' + +RSpec.describe "induties/assign_in_duties/index", type: :view do + before(:each) do + assign(:induties_assign_in_duties, [ + Induties::AssignInDuty.create!(), + Induties::AssignInDuty.create!() + ]) + end + + it "renders a list of induties/assign_in_duties" do + render + end +end diff --git a/spec/views/induties/assign_in_duties/new.html.erb_spec.rb b/spec/views/induties/assign_in_duties/new.html.erb_spec.rb new file mode 100644 index 00000000..ec73264c --- /dev/null +++ b/spec/views/induties/assign_in_duties/new.html.erb_spec.rb @@ -0,0 +1,14 @@ +require 'rails_helper' + +RSpec.describe "induties/assign_in_duties/new", type: :view do + before(:each) do + assign(:induties_assign_in_duty, Induties::AssignInDuty.new()) + end + + it "renders new induties_assign_in_duty form" do + render + + assert_select "form[action=?][method=?]", induties_assign_in_duties_path, "post" do + end + end +end diff --git a/spec/views/induties/assign_in_duties/show.html.erb_spec.rb b/spec/views/induties/assign_in_duties/show.html.erb_spec.rb new file mode 100644 index 00000000..79e1a2a7 --- /dev/null +++ b/spec/views/induties/assign_in_duties/show.html.erb_spec.rb @@ -0,0 +1,11 @@ +require 'rails_helper' + +RSpec.describe "induties/assign_in_duties/show", type: :view do + before(:each) do + @induties_assign_in_duty = assign(:induties_assign_in_duty, Induties::AssignInDuty.create!()) + end + + it "renders attributes in

" do + render + end +end diff --git a/test/system/assign_in_duties_test.rb b/test/system/assign_in_duties_test.rb new file mode 100644 index 00000000..0d4d523b --- /dev/null +++ b/test/system/assign_in_duties_test.rb @@ -0,0 +1,9 @@ +require "application_system_test_case" + +class Induties::AssignInDutiesTest < ApplicationSystemTestCase + # test "visiting the index" do + # visit induties_assign_in_duties_url + # + # assert_selector "h1", text: "Induties::AssignInDuty" + # end +end