From e9b1bb7832e6e33bd477f9df772e2e3b4791f433 Mon Sep 17 00:00:00 2001 From: Bill Cromie Date: Tue, 16 Aug 2016 19:10:11 -0400 Subject: [PATCH] updated annotations --- app/models/gift_card.rb | 21 ++++ app/models/person.rb | 5 + app/models/submission.rb | 2 +- app/models/user.rb | 1 + app/models/v2/event_invitation.rb | 25 ++--- app/models/v2/reservation.rb | 1 + .../controllers/gift_cards_controller_spec.rb | 102 +++++++++--------- spec/factories/gift_cards.rb | 21 ++++ spec/factories/people.rb | 5 + spec/factories/users.rb | 1 + spec/models/gift_card_spec.rb | 21 ++++ spec/models/person_spec.rb | 5 + spec/models/v2/event_invitation_spec.rb | 25 ++--- spec/models/v2/reservation_spec.rb | 1 + test/fixtures/people.yml | 5 + test/fixtures/submissions.yml | 2 +- test/fixtures/users.yml | 1 + test/models/person_test.rb | 5 + test/models/submission_test.rb | 2 +- 19 files changed, 173 insertions(+), 78 deletions(-) diff --git a/app/models/gift_card.rb b/app/models/gift_card.rb index b6c28f0ed..0cc256e3e 100644 --- a/app/models/gift_card.rb +++ b/app/models/gift_card.rb @@ -1,3 +1,24 @@ +# == Schema Information +# +# Table name: gift_cards +# +# id :integer not null, primary key +# gift_card_number :string(255) +# expiration_date :string(255) +# person_id :integer +# notes :string(255) +# created_by :integer +# reason :integer +# amount_cents :integer default(0), not null +# amount_currency :string(255) default("USD"), not null +# giftable_id :integer +# giftable_type :string(255) +# created_at :datetime not null +# updated_at :datetime not null +# batch_id :string(255) +# proxy_id :integer +# + require 'csv' class GiftCard < ActiveRecord::Base diff --git a/app/models/person.rb b/app/models/person.rb index 151c91795..fa3d9cf90 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -31,6 +31,11 @@ # verified :string(255) # preferred_contact_method :string(255) # token :string(255) +# active :boolean default(TRUE) +# deactivated_at :datetime +# deactivated_method :string(255) +# neighborhood :string(255) +# tag_count_cache :integer default(0) # # FIXME: Refactor and re-enable cop diff --git a/app/models/submission.rb b/app/models/submission.rb index 55f17315b..baa216ffa 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -12,7 +12,7 @@ # created_at :datetime # updated_at :datetime # form_id :string(255) -# form_type :integer +# form_type :integer default(0) # class Submission < ActiveRecord::Base diff --git a/app/models/user.rb b/app/models/user.rb index a853ec2c0..7a1f4325a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -20,6 +20,7 @@ # approved :boolean default(FALSE), not null # name :string(255) # token :string(255) +# phone_number :string(255) # class User < ActiveRecord::Base diff --git a/app/models/v2/event_invitation.rb b/app/models/v2/event_invitation.rb index 1994d9ca0..60f4aa0b5 100644 --- a/app/models/v2/event_invitation.rb +++ b/app/models/v2/event_invitation.rb @@ -2,18 +2,19 @@ # # Table name: v2_event_invitations # -# id :integer not null, primary key -# v2_event_id :integer -# email_addresses :string(255) -# description :string(255) -# slot_length :string(255) -# date :string(255) -# start_time :string(255) -# end_time :string(255) -# buffer :integer default(0), not null -# created_at :datetime -# updated_at :datetime -# user_id :integer +# id :integer not null, primary key +# v2_event_id :integer +# people_ids :string(255) +# description :string(255) +# slot_length :string(255) +# date :string(255) +# start_time :string(255) +# end_time :string(255) +# buffer :integer default(0), not null +# created_at :datetime +# updated_at :datetime +# user_id :integer +# title :string(255) # class V2::EventInvitation < ActiveRecord::Base diff --git a/app/models/v2/reservation.rb b/app/models/v2/reservation.rb index 01b12632f..2abc8b5dc 100644 --- a/app/models/v2/reservation.rb +++ b/app/models/v2/reservation.rb @@ -10,6 +10,7 @@ # user_id :integer # event_id :integer # event_invitation_id :integer +# aasm_state :string(255) # # FIXME: Refactor and re-enable cop diff --git a/spec/controllers/gift_cards_controller_spec.rb b/spec/controllers/gift_cards_controller_spec.rb index de3809506..0ba610f3b 100644 --- a/spec/controllers/gift_cards_controller_spec.rb +++ b/spec/controllers/gift_cards_controller_spec.rb @@ -34,7 +34,7 @@ expiration_date: "05/20", proxy_id:'4321', batch_id: '4321', - gift_card_number: '12345' + last_four: '12345' } } @@ -117,70 +117,70 @@ post :create, {:gift_card => valid_attributes} expect(response).to render_template("new") expect(GiftCard.count).to eq(1) + end end - end - describe "PUT #update" do - context "with valid params" do - let(:new_attributes) { - { - expiration_date: "05/20", - proxy_id:'4321', - batch_id: '4321', - gift_card_number: '12345' - reason: "test", - amount: "15.00" + describe "PUT #update" do + context "with valid params" do + let(:new_attributes) { + { + expiration_date: "05/20", + proxy_id:'4321', + batch_id: '4321', + last_four: '12345', + reason: "test", + amount: "15.00" + } } - } - - it "updates the requested gift_card" do - gift_card = GiftCard.create! valid_attributes - put :update, {:id => gift_card.to_param, :gift_card => new_attributes} - gift_card.reload - expect(gift_card.amount).to have_content "15.00" - end - it "assigns the requested gift_card as @gift_card" do - gift_card = GiftCard.create! valid_attributes - put :update, {:id => gift_card.to_param, :gift_card => valid_attributes} - expect(assigns(:gift_card)).to eq(gift_card) + it "updates the requested gift_card" do + gift_card = GiftCard.create! valid_attributes + put :update, {:id => gift_card.to_param, :gift_card => new_attributes} + gift_card.reload + expect(gift_card.amount).to have_content "15.00" + end + + it "assigns the requested gift_card as @gift_card" do + gift_card = GiftCard.create! valid_attributes + put :update, {:id => gift_card.to_param, :gift_card => valid_attributes} + expect(assigns(:gift_card)).to eq(gift_card) + end + + it "redirects to the gift_card" do + gift_card = GiftCard.create! valid_attributes + put :update, {:id => gift_card.to_param, :gift_card => valid_attributes} + expect(response).to redirect_to(gift_card) + end end - it "redirects to the gift_card" do - gift_card = GiftCard.create! valid_attributes - put :update, {:id => gift_card.to_param, :gift_card => valid_attributes} - expect(response).to redirect_to(gift_card) + context "with invalid params" do + it "assigns the gift_card as @gift_card" do + gift_card = GiftCard.create! valid_attributes + put :update, {:id => gift_card.to_param, :gift_card => invalid_attributes} + expect(assigns(:gift_card)).to eq(gift_card) + end + + it "re-renders the 'edit' template" do + gift_card = GiftCard.create! valid_attributes + put :update, {:id => gift_card.to_param, :gift_card => invalid_attributes} + expect(response).to render_template("edit") + end end end - context "with invalid params" do - it "assigns the gift_card as @gift_card" do + describe "DELETE #destroy" do + it "destroys the requested gift_card" do gift_card = GiftCard.create! valid_attributes - put :update, {:id => gift_card.to_param, :gift_card => invalid_attributes} - expect(assigns(:gift_card)).to eq(gift_card) + expect { + delete :destroy, {:id => gift_card.to_param} + }.to change(GiftCard, :count).by(-1) end - it "re-renders the 'edit' template" do + it "redirects to the gift_cards list" do gift_card = GiftCard.create! valid_attributes - put :update, {:id => gift_card.to_param, :gift_card => invalid_attributes} - expect(response).to render_template("edit") - end - end - end - - describe "DELETE #destroy" do - it "destroys the requested gift_card" do - gift_card = GiftCard.create! valid_attributes - expect { delete :destroy, {:id => gift_card.to_param} - }.to change(GiftCard, :count).by(-1) - end - - it "redirects to the gift_cards list" do - gift_card = GiftCard.create! valid_attributes - delete :destroy, {:id => gift_card.to_param} - expect(response).to redirect_to(gift_cards_url) + expect(response).to redirect_to(gift_cards_url) + end end end - end diff --git a/spec/factories/gift_cards.rb b/spec/factories/gift_cards.rb index 0d63f383d..27eb0bce3 100644 --- a/spec/factories/gift_cards.rb +++ b/spec/factories/gift_cards.rb @@ -1,3 +1,24 @@ +# == Schema Information +# +# Table name: gift_cards +# +# id :integer not null, primary key +# gift_card_number :string(255) +# expiration_date :string(255) +# person_id :integer +# notes :string(255) +# created_by :integer +# reason :integer +# amount_cents :integer default(0), not null +# amount_currency :string(255) default("USD"), not null +# giftable_id :integer +# giftable_type :string(255) +# created_at :datetime not null +# updated_at :datetime not null +# batch_id :string(255) +# proxy_id :integer +# + FactoryGirl.define do factory :gift_card do last_four 1 diff --git a/spec/factories/people.rb b/spec/factories/people.rb index 71e395f36..a5a658a64 100644 --- a/spec/factories/people.rb +++ b/spec/factories/people.rb @@ -31,6 +31,11 @@ # verified :string(255) # preferred_contact_method :string(255) # token :string(255) +# active :boolean default(TRUE) +# deactivated_at :datetime +# deactivated_method :string(255) +# neighborhood :string(255) +# tag_count_cache :integer default(0) # require 'faker' diff --git a/spec/factories/users.rb b/spec/factories/users.rb index f91792a67..e15596afc 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -20,6 +20,7 @@ # approved :boolean default(FALSE), not null # name :string(255) # token :string(255) +# phone_number :string(255) # require 'faker' diff --git a/spec/models/gift_card_spec.rb b/spec/models/gift_card_spec.rb index ed79e3c49..a14e51003 100644 --- a/spec/models/gift_card_spec.rb +++ b/spec/models/gift_card_spec.rb @@ -1,3 +1,24 @@ +# == Schema Information +# +# Table name: gift_cards +# +# id :integer not null, primary key +# gift_card_number :string(255) +# expiration_date :string(255) +# person_id :integer +# notes :string(255) +# created_by :integer +# reason :integer +# amount_cents :integer default(0), not null +# amount_currency :string(255) default("USD"), not null +# giftable_id :integer +# giftable_type :string(255) +# created_at :datetime not null +# updated_at :datetime not null +# batch_id :string(255) +# proxy_id :integer +# + require 'rails_helper' RSpec.describe GiftCard, type: :model do diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb index 5d6417ef5..d283071d6 100644 --- a/spec/models/person_spec.rb +++ b/spec/models/person_spec.rb @@ -31,6 +31,11 @@ # verified :string(255) # preferred_contact_method :string(255) # token :string(255) +# active :boolean default(TRUE) +# deactivated_at :datetime +# deactivated_method :string(255) +# neighborhood :string(255) +# tag_count_cache :integer default(0) # require 'rails_helper' diff --git a/spec/models/v2/event_invitation_spec.rb b/spec/models/v2/event_invitation_spec.rb index 2047cf510..5a33b8fce 100644 --- a/spec/models/v2/event_invitation_spec.rb +++ b/spec/models/v2/event_invitation_spec.rb @@ -2,18 +2,19 @@ # # Table name: v2_event_invitations # -# id :integer not null, primary key -# v2_event_id :integer -# email_addresses :string(255) -# description :string(255) -# slot_length :string(255) -# date :string(255) -# start_time :string(255) -# end_time :string(255) -# buffer :integer default(0), not null -# created_at :datetime -# updated_at :datetime -# user_id :integer +# id :integer not null, primary key +# v2_event_id :integer +# people_ids :string(255) +# description :string(255) +# slot_length :string(255) +# date :string(255) +# start_time :string(255) +# end_time :string(255) +# buffer :integer default(0), not null +# created_at :datetime +# updated_at :datetime +# user_id :integer +# title :string(255) # require 'rails_helper' diff --git a/spec/models/v2/reservation_spec.rb b/spec/models/v2/reservation_spec.rb index 2d75e35b2..e8b993498 100644 --- a/spec/models/v2/reservation_spec.rb +++ b/spec/models/v2/reservation_spec.rb @@ -10,6 +10,7 @@ # user_id :integer # event_id :integer # event_invitation_id :integer +# aasm_state :string(255) # require 'rails_helper' diff --git a/test/fixtures/people.yml b/test/fixtures/people.yml index e521ef9ee..013212013 100644 --- a/test/fixtures/people.yml +++ b/test/fixtures/people.yml @@ -31,6 +31,11 @@ # verified :string(255) # preferred_contact_method :string(255) # token :string(255) +# active :boolean default(TRUE) +# deactivated_at :datetime +# deactivated_method :string(255) +# neighborhood :string(255) +# tag_count_cache :integer default(0) # one: diff --git a/test/fixtures/submissions.yml b/test/fixtures/submissions.yml index b88f92205..f61f175d2 100644 --- a/test/fixtures/submissions.yml +++ b/test/fixtures/submissions.yml @@ -12,7 +12,7 @@ # created_at :datetime # updated_at :datetime # form_id :string(255) -# form_type :integer +# form_type :integer default(0) # # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 83b4a2a5a..d377557d1 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -20,6 +20,7 @@ # approved :boolean default(FALSE), not null # name :string(255) # token :string(255) +# phone_number :string(255) # admin: diff --git a/test/models/person_test.rb b/test/models/person_test.rb index df85affa1..f5a33c6ce 100644 --- a/test/models/person_test.rb +++ b/test/models/person_test.rb @@ -31,6 +31,11 @@ # verified :string(255) # preferred_contact_method :string(255) # token :string(255) +# active :boolean default(TRUE) +# deactivated_at :datetime +# deactivated_method :string(255) +# neighborhood :string(255) +# tag_count_cache :integer default(0) # require 'test_helper' diff --git a/test/models/submission_test.rb b/test/models/submission_test.rb index 4b87337a8..a0f326389 100644 --- a/test/models/submission_test.rb +++ b/test/models/submission_test.rb @@ -12,7 +12,7 @@ # created_at :datetime # updated_at :datetime # form_id :string(255) -# form_type :integer +# form_type :integer default(0) # require 'test_helper'