Skip to content

Commit

Permalink
updated annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
cromulus committed Aug 16, 2016
1 parent 9fe1f4a commit e9b1bb7
Show file tree
Hide file tree
Showing 19 changed files with 173 additions and 78 deletions.
21 changes: 21 additions & 0 deletions app/models/gift_card.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/models/submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# approved :boolean default(FALSE), not null
# name :string(255)
# token :string(255)
# phone_number :string(255)
#

class User < ActiveRecord::Base
Expand Down
25 changes: 13 additions & 12 deletions app/models/v2/event_invitation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/models/v2/reservation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# user_id :integer
# event_id :integer
# event_invitation_id :integer
# aasm_state :string(255)
#

# FIXME: Refactor and re-enable cop
Expand Down
102 changes: 51 additions & 51 deletions spec/controllers/gift_cards_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
expiration_date: "05/20",
proxy_id:'4321',
batch_id: '4321',
gift_card_number: '12345'
last_four: '12345'
}
}

Expand Down Expand Up @@ -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
21 changes: 21 additions & 0 deletions spec/factories/gift_cards.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions spec/factories/people.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions spec/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# approved :boolean default(FALSE), not null
# name :string(255)
# token :string(255)
# phone_number :string(255)
#

require 'faker'
Expand Down
21 changes: 21 additions & 0 deletions spec/models/gift_card_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions spec/models/person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
25 changes: 13 additions & 12 deletions spec/models/v2/event_invitation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions spec/models/v2/reservation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# user_id :integer
# event_id :integer
# event_invitation_id :integer
# aasm_state :string(255)
#

require 'rails_helper'
Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/people.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/submissions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# approved :boolean default(FALSE), not null
# name :string(255)
# token :string(255)
# phone_number :string(255)
#

admin:
Expand Down
5 changes: 5 additions & 0 deletions test/models/person_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion test/models/submission_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit e9b1bb7

Please sign in to comment.