diff --git a/app/views/canonical_items/show.html.erb b/app/views/admin/canonical_items/show.html.erb
similarity index 95%
rename from app/views/canonical_items/show.html.erb
rename to app/views/admin/canonical_items/show.html.erb
index 43bc75ae24..9ddc3702f9 100644
--- a/app/views/canonical_items/show.html.erb
+++ b/app/views/admin/canonical_items/show.html.erb
@@ -9,7 +9,7 @@
Home
<% end %>
-
diff --git a/app/views/admins/edit.html.erb b/app/views/admin/organizations/edit.html.erb
similarity index 92%
rename from app/views/admins/edit.html.erb
rename to app/views/admin/organizations/edit.html.erb
index 93c58014b8..269b1a61bf 100644
--- a/app/views/admins/edit.html.erb
+++ b/app/views/admin/organizations/edit.html.erb
@@ -9,7 +9,7 @@ Editing
Home
<% end %>
-
+
diff --git a/app/views/admins/new.html.erb b/app/views/admin/organizations/new.html.erb
similarity index 88%
rename from app/views/admins/new.html.erb
rename to app/views/admin/organizations/new.html.erb
index 2352acdd88..36152b4e63 100644
--- a/app/views/admins/new.html.erb
+++ b/app/views/admin/organizations/new.html.erb
@@ -9,7 +9,7 @@ New Organization
Home
<% end %>
-
+ <%= link_to new_admin_user_path, class: "btn btn-success" do %>
+ <%= fa_icon "plus" %> Add a user
+ <% end %>
+
+
+
+
+
+
+
+
+
Organization
+
Name
+
Email
+
+
+
+
+
+ <% @users.each do |user| %>
+
+
<%= user.organization.name %>
+
<%= user.name %>
+
<%= user.email %>
+
+ <% if user != current_user %>
+ <%= link_to admin_user_path(user), method: :delete, confirm: "Are you sure you want to permanently remove this user?", class: "btn btn-danger btn-xs" do %>
+ <%= fa_icon "trash" %> Delete
+ <% end %>
+ <% end %>
+
+
+ <%= link_to edit_user_registration_path(user), class: "btn btn-info btn-xs" do %>
+ <%= fa_icon "edit" %> Edit
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/admin/users/new.html.erb b/app/views/admin/users/new.html.erb
new file mode 100644
index 0000000000..ab92a05007
--- /dev/null
+++ b/app/views/admin/users/new.html.erb
@@ -0,0 +1,43 @@
+
- <% end %>
- <% ############# END SIGNED IN ############### %>
- <% end %>
- <% ############# SIGNED IN ############### %>
- <% # This should really be DRYed out %>
- <% if user_signed_in? %>
-
\ No newline at end of file
diff --git a/app/views/layouts/_lte_sidebar.html.erb b/app/views/layouts/_lte_sidebar.html.erb
index ffaec27f55..5a123ecd60 100644
--- a/app/views/layouts/_lte_sidebar.html.erb
+++ b/app/views/layouts/_lte_sidebar.html.erb
@@ -1,163 +1,141 @@
-<% if controller.controller_name != "admins" %>
-
-
- <% end %>
- <% ############# END SIGNED IN ############### %>
- <% end %>
- <% ############# SIGNED IN ############### %>
- <% # This should really be DRYed out %>
- <% if user_signed_in? %>
-
+ <%= form_tag invite_user_organization_path do %>
+
+ <%= fa_icon "user" %>
+
+
+
+
+ <%= fa_icon "envelope" %>
+
+
+ <%= hidden_field_tag :org , @organization.id %>
+ <%= button_tag :submit, class:"btn btn-primary btn-lg" do %>
+ Invite User
+ <% end %>
+ <% end # form %>
+
+
+
+
+
+<% end # if can_administrate %>
+
+
+
+<% if can_administrate %>
+ <%= link_to edit_organization_path do %>
+ Edit
+ <% end %>
+<% end %>
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
index d09358400b..a7ef5da776 100644
--- a/app/views/users/index.html.erb
+++ b/app/views/users/index.html.erb
@@ -33,7 +33,6 @@
Name
Email
-
@@ -41,17 +40,6 @@
<%= user.name %>
<%= user.email %>
-
- <% if user != current_user %>
- <%= link_to user_path(user), method: :delete, confirm: "Are you sure you want to permanently remove this user?", class: "btn btn-danger btn-xs" do %>
- <%= fa_icon "trash" %> Delete
- <% end %>
- <% else %>
- <%= link_to edit_user_registration_path(organization_id: nil), class: "btn btn-info btn-xs" do %>
- <%= fa_icon "edit" %> Edit
- <% end %>
- <% end %>
-
<% end %>
@@ -62,4 +50,5 @@
+
diff --git a/config/routes.rb b/config/routes.rb
index 3d0aa48731..1358972de5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -8,12 +8,17 @@
end
mount flipper_app, at: "/flipper"
- resources :admins do
- collection do
- post :invite_user
- end
+ # This is where a superadmin CRUDs all the things
+ namespace :admin do
+ get :dashboard
+ resources :canonical_items
+ resources :organizations
+ resources :users
+ resources :barcode_items
end
- resources :canonical_items
+
+ # These are globally accessible
+ resources :canonical_items, only: %i(index show)
namespace :api, defaults: { format: "json" } do
namespace :v1 do
@@ -24,9 +29,12 @@
scope path: ":organization_id" do
resources :users
- resource :organization do
+
+ # Users that are organization admins can manage the organization itself
+ resource :organization, only: [:show]
+ resource :organization, path: :manage, only: %i(edit update) do
collection do
- get :manage
+ post :invite_user
end
end
diff --git a/db/migrate/20180915191418_add_super_admin_to_user.rb b/db/migrate/20180915191418_add_super_admin_to_user.rb
new file mode 100644
index 0000000000..810d189050
--- /dev/null
+++ b/db/migrate/20180915191418_add_super_admin_to_user.rb
@@ -0,0 +1,5 @@
+class AddSuperAdminToUser < ActiveRecord::Migration[5.2]
+ def change
+ add_column :users, :super_admin, :boolean, default: false
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index d030633066..1b2fd1b134 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -86,8 +86,8 @@
create_table "distributions", id: :serial, force: :cascade do |t|
t.text "comment"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
+ t.datetime "created_at"
+ t.datetime "updated_at"
t.integer "storage_location_id"
t.integer "partner_id"
t.integer "organization_id"
@@ -101,8 +101,8 @@
create_table "donation_sites", id: :serial, force: :cascade do |t|
t.string "name"
t.string "address"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
+ t.datetime "created_at"
+ t.datetime "updated_at"
t.integer "organization_id"
t.float "latitude"
t.float "longitude"
@@ -113,8 +113,8 @@
create_table "donations", id: :serial, force: :cascade do |t|
t.string "source"
t.integer "donation_site_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
+ t.datetime "created_at"
+ t.datetime "updated_at"
t.integer "storage_location_id"
t.text "comment"
t.integer "organization_id"
@@ -146,15 +146,15 @@
t.integer "storage_location_id"
t.integer "item_id"
t.integer "quantity", default: 0
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
+ t.datetime "created_at"
+ t.datetime "updated_at"
end
create_table "items", id: :serial, force: :cascade do |t|
t.string "name"
t.string "category"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
+ t.datetime "created_at"
+ t.datetime "updated_at"
t.integer "barcode_count"
t.integer "organization_id"
t.integer "canonical_item_id"
@@ -193,8 +193,8 @@
create_table "partners", id: :serial, force: :cascade do |t|
t.string "name"
t.string "email"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
+ t.datetime "created_at"
+ t.datetime "updated_at"
t.integer "organization_id"
t.string "status"
t.index ["organization_id"], name: "index_partners_on_organization_id"
@@ -229,8 +229,8 @@
create_table "storage_locations", id: :serial, force: :cascade do |t|
t.string "name"
t.string "address"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
+ t.datetime "created_at"
+ t.datetime "updated_at"
t.integer "organization_id"
t.float "latitude"
t.float "longitude"
@@ -272,11 +272,11 @@
t.integer "invitations_count", default: 0
t.boolean "organization_admin"
t.string "name", default: "CHANGEME", null: false
+ t.boolean "super_admin", default: false
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["invitation_token"], name: "index_users_on_invitation_token", unique: true
t.index ["invitations_count"], name: "index_users_on_invitations_count"
t.index ["invited_by_id"], name: "index_users_on_invited_by_id"
- t.index ["invited_by_type", "invited_by_id"], name: "index_users_on_invited_by_type_and_invited_by_id"
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
diff --git a/db/seeds.rb b/db/seeds.rb
index afb64e7c23..a965f53d1e 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -38,8 +38,17 @@
end
Organization.seed_items(sf_org)
-user = User.create email: 'test@example.com', password: 'password', password_confirmation: 'password', organization: pdx_org, organization_admin: true
-user2 = User.create email: 'test2@example.com', password: 'password', password_confirmation: 'password', organization: sf_org
+# super admin
+user = User.create email: 'superadmin@example.com', password: 'password', password_confirmation: 'password', organization_admin: false, super_admin: true
+
+# org admins
+user = User.create email: 'org_admin1@example.com', password: 'password', password_confirmation: 'password', organization: pdx_org, organization_admin: true
+user2 = User.create email: 'org_admin2@example.com', password: 'password', password_confirmation: 'password', organization: sf_org, organization_admin: true
+
+# regular users
+User.create email: 'user_1@example.com', password: 'password', password_confirmation: 'password', organization: pdx_org, organization_admin: false
+User.create email: 'user_2@example.com', password: 'password', password_confirmation: 'password', organization: sf_org, organization_admin: false
+
DonationSite.find_or_create_by!(name: "Know Thy Food & Warehouse Cafe") do |location|
location.address = "3434 SE Milwaukie Ave., Portland, OR 97202"
diff --git a/spec/controllers/admin/barcode_items_controller_spec.rb b/spec/controllers/admin/barcode_items_controller_spec.rb
new file mode 100644
index 0000000000..cb132e89e0
--- /dev/null
+++ b/spec/controllers/admin/barcode_items_controller_spec.rb
@@ -0,0 +1,28 @@
+RSpec.describe Admin::BarcodeItemsController, type: :controller do
+ context "while signed in as a super admin" do
+ before do
+ sign_in(@super_admin)
+ end
+
+ describe "DELETE #destroy" do
+ it "can delete anyone's barcode" do
+ allow_any_instance_of(User).to receive(:super_admin?).and_return(true)
+ other_org = create(:organization)
+ other_barcode = create(:barcode_item, organization_id: other_org.id, global: false)
+ expect do
+ delete :destroy, params: { id: other_barcode.to_param }
+ end.to change { BarcodeItem.count }.by(-1)
+ expect(flash.to_h).not_to have_key("error")
+ end
+
+ it "allows deletion of a global barcode" do
+ allow_any_instance_of(User).to receive(:super_admin?).and_return(true)
+ other_barcode = create(:barcode_item, global: true)
+ expect do
+ delete :destroy, params: { id: other_barcode.to_param }
+ end.to change { BarcodeItem.count }.by(-1)
+ expect(flash.to_h).not_to have_key("error")
+ end
+ end
+ end
+end
\ No newline at end of file
diff --git a/spec/controllers/admin/canonical_items_controller_spec.rb b/spec/controllers/admin/canonical_items_controller_spec.rb
new file mode 100644
index 0000000000..190b3ef90d
--- /dev/null
+++ b/spec/controllers/admin/canonical_items_controller_spec.rb
@@ -0,0 +1,104 @@
+RSpec.describe Admin::CanonicalItemsController, type: :controller do
+ context "while signed in as a super admin" do
+ before do
+ sign_in(@super_admin)
+ end
+ end
+=begin
+ context "When logged in as an organization admin" do
+ before do
+ sign_in(@organization_admin)
+ end
+
+ describe "GET #new" do
+ it "returns http success" do
+ get :new
+ expect(response).to be_successful
+ end
+ end
+
+ describe "POST #create" do
+ it "redirects" do
+ post :create, params: { organization: attributes_for(:organization) }
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "GET #index" do
+ it "returns http success" do
+ get :index
+ expect(response).to be_successful
+ end
+ end
+
+ describe "GET #show" do
+ it "returns http success" do
+ get :show, params: { id: @organization.id }
+ expect(response).to be_successful
+ end
+ end
+
+ describe "GET #edit" do
+ it "returns http success" do
+ get :edit, params: { id: @organization.id }
+ expect(response).to be_successful
+ end
+ end
+
+ describe "PUT #update" do
+ it "redirect" do
+ put :update, params: { id: @organization.id, organization: { name: "Foo" } }
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "DELETE #destroy" do
+ it "redirects" do
+ delete :destroy, params: { id: @organization.id }
+ expect(response).to be_redirect
+ end
+ end
+ end
+
+ context "When logged in as a non-admin user" do
+ before do
+ sign_in(@user)
+ end
+
+ describe "GET #new" do
+ it "redirects" do
+ get :new
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "POST #create" do
+ it "redirects" do
+ post :create, params: { organization: attributes_for(:organization) }
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "GET #index" do
+ it "redirects" do
+ get :index
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "GET #edit" do
+ it "redirects" do
+ get :edit, params: { id: @organization.id }
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "PUT #update" do
+ it "redirects" do
+ put :update, params: { id: @organization.id, organization: { name: "Foo" } }
+ expect(response).to be_redirect
+ end
+ end
+ end
+=end
+end
diff --git a/spec/controllers/admin/organizations_controller_spec.rb b/spec/controllers/admin/organizations_controller_spec.rb
new file mode 100644
index 0000000000..f86ceec1fc
--- /dev/null
+++ b/spec/controllers/admin/organizations_controller_spec.rb
@@ -0,0 +1,104 @@
+RSpec.describe Admin::OrganizationsController, type: :controller do
+ let(:default_params) do
+ { organization_id: @organization.id }
+ end
+
+ context "When logged in as a super admin" do
+ before do
+ sign_in(@super_admin)
+ end
+
+ describe "GET #new" do
+ it "returns http success" do
+ get :new
+ expect(response).to be_successful
+ end
+ end
+
+ describe "POST #create" do
+ it "redirects" do
+ post :create, params: { organization: attributes_for(:organization) }
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "GET #index" do
+ it "returns http success" do
+ get :index
+ expect(response).to be_successful
+ end
+ end
+ end
+=begin
+
+ describe "GET #show" do
+ it "returns http success" do
+ get :show, params: { id: @organization.id }
+ expect(response).to be_successful
+ end
+ end
+
+ describe "GET #edit" do
+ it "returns http success" do
+ get :edit, params: { id: @organization.id }
+ expect(response).to be_successful
+ end
+ end
+
+ describe "PUT #update" do
+ it "redirect" do
+ put :update, params: { id: @organization.id, organization: { name: "Foo" } }
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "DELETE #destroy" do
+ it "redirects" do
+ delete :destroy, params: { id: @organization.id }
+ expect(response).to be_redirect
+ end
+ end
+ end
+
+ context "When logged in as a non-admin user" do
+ before do
+ sign_in(@user)
+ end
+
+ describe "GET #new" do
+ it "redirects" do
+ get :new
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "POST #create" do
+ it "redirects" do
+ post :create, params: { organization: attributes_for(:organization) }
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "GET #index" do
+ it "redirects" do
+ get :index
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "GET #edit" do
+ it "redirects" do
+ get :edit, params: { id: @organization.id }
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "PUT #update" do
+ it "redirects" do
+ put :update, params: { id: @organization.id, organization: { name: "Foo" } }
+ expect(response).to be_redirect
+ end
+ end
+ end
+=end
+end
diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb
new file mode 100644
index 0000000000..cd62ed6ce6
--- /dev/null
+++ b/spec/controllers/admin/users_controller_spec.rb
@@ -0,0 +1,102 @@
+RSpec.describe Admin::UsersController, type: :controller do
+ let(:default_params) do
+ { organization_id: @organization.id }
+ end
+=begin
+ context "When logged in as an organization admin" do
+ before do
+ sign_in(@organization_admin)
+ end
+
+ describe "GET #new" do
+ it "returns http success" do
+ get :new
+ expect(response).to be_successful
+ end
+ end
+
+ describe "POST #create" do
+ it "redirects" do
+ post :create, params: { organization: attributes_for(:organization) }
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "GET #index" do
+ it "returns http success" do
+ get :index
+ expect(response).to be_successful
+ end
+ end
+
+ describe "GET #show" do
+ it "returns http success" do
+ get :show, params: { id: @organization.id }
+ expect(response).to be_successful
+ end
+ end
+
+ describe "GET #edit" do
+ it "returns http success" do
+ get :edit, params: { id: @organization.id }
+ expect(response).to be_successful
+ end
+ end
+
+ describe "PUT #update" do
+ it "redirect" do
+ put :update, params: { id: @organization.id, organization: { name: "Foo" } }
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "DELETE #destroy" do
+ it "redirects" do
+ delete :destroy, params: { id: @organization.id }
+ expect(response).to be_redirect
+ end
+ end
+ end
+
+ context "When logged in as a non-admin user" do
+ before do
+ sign_in(@user)
+ end
+
+ describe "GET #new" do
+ it "redirects" do
+ get :new
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "POST #create" do
+ it "redirects" do
+ post :create, params: { organization: attributes_for(:organization) }
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "GET #index" do
+ it "redirects" do
+ get :index
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "GET #edit" do
+ it "redirects" do
+ get :edit, params: { id: @organization.id }
+ expect(response).to be_redirect
+ end
+ end
+
+ describe "PUT #update" do
+ it "redirects" do
+ put :update, params: { id: @organization.id, organization: { name: "Foo" } }
+ expect(response).to be_redirect
+ end
+ end
+ end
+=end
+end
diff --git a/spec/controllers/admin_controller_spec.rb b/spec/controllers/admin_controller_spec.rb
new file mode 100644
index 0000000000..4ec5af9c9f
--- /dev/null
+++ b/spec/controllers/admin_controller_spec.rb
@@ -0,0 +1,7 @@
+RSpec.describe AdminController, type: :controller do
+ context "while signed in as a super admin" do
+ before do
+ sign_in(@super_admin)
+ end
+ end
+end
\ No newline at end of file
diff --git a/spec/controllers/admins_controller_spec.rb b/spec/controllers/admins_controller_spec.rb
index 3478accd83..22ad1dcf3c 100644
--- a/spec/controllers/admins_controller_spec.rb
+++ b/spec/controllers/admins_controller_spec.rb
@@ -1,3 +1,4 @@
+=begin
require "rails_helper"
RSpec.describe AdminsController, type: :controller do
@@ -101,3 +102,4 @@
end
end
end
+=end
\ No newline at end of file
diff --git a/spec/controllers/barcode_items_controller_spec.rb b/spec/controllers/barcode_items_controller_spec.rb
index 936e5dcdab..c8361fa831 100644
--- a/spec/controllers/barcode_items_controller_spec.rb
+++ b/spec/controllers/barcode_items_controller_spec.rb
@@ -70,23 +70,13 @@
end
it "disallows a non-superadmin to delete a global barcode" do
- allow_any_instance_of(User).to receive(:is_superadmin?).and_return(false)
+ allow_any_instance_of(User).to receive(:super_admin?).and_return(false)
global_barcode = create(:global_barcode_item)
delete :destroy, params: default_params.merge(id: global_barcode.to_param)
expect(response).not_to be_successful
expect(flash[:error]).to match(/permission/)
end
- it "allows a superadmin to delete anyone's barcode" do
- allow_any_instance_of(User).to receive(:is_superadmin?).and_return(true)
- other_org = create(:organization)
- other_barcode = create(:barcode_item, organization_id: other_org.id, global: false)
- expect do
- delete :destroy, params: default_params.merge(id: other_barcode.to_param)
- end.to change { BarcodeItem.count }.by(-1)
- expect(flash.to_h).not_to have_key("error")
- end
-
it "redirects to the index" do
delete :destroy, params: default_params.merge(id: create(:barcode_item, global: false, organization_id: @organization.id))
expect(subject).to redirect_to(barcode_items_path)
diff --git a/spec/controllers/organizations_controller_spec.rb b/spec/controllers/organizations_controller_spec.rb
index e045c72d62..15db40ba07 100644
--- a/spec/controllers/organizations_controller_spec.rb
+++ b/spec/controllers/organizations_controller_spec.rb
@@ -1,30 +1,84 @@
-require "rails_helper"
-
RSpec.describe OrganizationsController, type: :controller do
let(:default_params) do
{ organization_id: @organization.to_param }
end
- before do
- sign_in(@user)
- end
+ context "While signed in as a normal user" do
+ before do
+ sign_in(@user)
+ end
+
+ describe "GET #show" do
+ subject { get :show, params: default_params }
+
+ it "is successful" do
+ expect(subject).to be_successful
+ end
+ end
- describe "GET #edit" do
- subject { get :edit, params: default_params }
+ describe "GET #edit" do
+ subject { get :edit, params: default_params }
- it "is successful" do
- expect(subject).to be_successful
+ it "denies access and redirects with an error" do
+ expect(subject).to have_http_status(:redirect)
+ expect(flash[:error]).to be_present
+ end
+ end
+
+ describe "PATCH #update" do
+ subject { patch :update, params: default_params.merge(organization: { name: "Thunder Pants" }) }
+
+ it "denies access" do
+ expect(subject).to have_http_status(:redirect)
+ expect(flash[:error]).to be_present
+ end
end
end
- describe "updating an existing organization" do
- subject { patch :update, params: default_params.merge(organization: { name: "Thunder Pants" }) }
+ context "While signed in as an organization admin" do
+ before do
+ sign_in(@organization_admin)
+ end
+ describe "GET #edit" do
+ subject { get :edit, params: default_params }
+
+ it "is successful" do
+ expect(subject).to be_successful
+ end
+ end
+
+ describe "PATCH #update" do
+ subject { patch :update, params: default_params.merge(organization: { name: "Thunder Pants" }) }
+
+ it "can update name" do
+ expect(subject).to have_http_status(:redirect)
+
+ @organization.reload
+ expect(@organization.name).to eq "Thunder Pants"
+ end
+ end
+
+ context "when attempting to access a different organization" do
+ let(:other_organization) { create(:organization) }
+ let(:other_organization_params) do
+ { organization_id: other_organization.to_param }
+ end
+
+ describe "GET #show" do
+ subject { get :show, params: other_organization_params }
+
+ it "redirects to dashboard" do
+ expect(subject).to redirect_to(dashboard_path)
+ end
+ end
- it "can update name" do
- expect(subject).to have_http_status(:redirect)
+ describe "GET #edit" do
+ subject { get :edit, params: other_organization_params }
- @organization.reload
- expect(@organization.name).to eq "Thunder Pants"
+ it "redirects to dashboard" do
+ expect(subject).to redirect_to(dashboard_path)
+ end
+ end
end
end
end
diff --git a/spec/example_failures.txt b/spec/example_failures.txt
new file mode 100644
index 0000000000..a91d2cc78f
--- /dev/null
+++ b/spec/example_failures.txt
@@ -0,0 +1,452 @@
+example_id | status | run_time |
+------------------------------------------------------------------------ | ------- | --------------- |
+./spec/controllers/adjustments_controller_spec.rb[1:1:1:1] | passed | 0.38939 seconds |
+./spec/controllers/adjustments_controller_spec.rb[1:1:2:1] | passed | 0.18584 seconds |
+./spec/controllers/adjustments_controller_spec.rb[1:1:3:1] | passed | 0.1684 seconds |
+./spec/controllers/adjustments_controller_spec.rb[1:1:4:1:1] | passed | 0.18338 seconds |
+./spec/controllers/adjustments_controller_spec.rb[1:1:4:1:2] | passed | 0.16953 seconds |
+./spec/controllers/adjustments_controller_spec.rb[1:1:4:1:3] | passed | 0.17081 seconds |
+./spec/controllers/adjustments_controller_spec.rb[1:1:4:2:1] | passed | 0.15976 seconds |
+./spec/controllers/adjustments_controller_spec.rb[1:1:4:2:2] | passed | 0.16321 seconds |
+./spec/controllers/admin/barcode_items_controller_spec.rb[1:1:1:1] | passed | 0.35468 seconds |
+./spec/controllers/admin/barcode_items_controller_spec.rb[1:1:1:2] | passed | 0.32209 seconds |
+./spec/controllers/admin/organizations_controller_spec.rb[1:1:1:1] | passed | 0.16786 seconds |
+./spec/controllers/admin/organizations_controller_spec.rb[1:1:2:1] | passed | 0.32224 seconds |
+./spec/controllers/admin/organizations_controller_spec.rb[1:1:3:1] | passed | 0.17114 seconds |
+./spec/controllers/barcode_items_controller_spec.rb[1:1:1:1] | passed | 0.17368 seconds |
+./spec/controllers/barcode_items_controller_spec.rb[1:1:2:1] | passed | 0.16287 seconds |
+./spec/controllers/barcode_items_controller_spec.rb[1:1:3:1] | passed | 0.17631 seconds |
+./spec/controllers/barcode_items_controller_spec.rb[1:1:4:1] | passed | 0.17445 seconds |
+./spec/controllers/barcode_items_controller_spec.rb[1:1:5:1:1] | passed | 0.33667 seconds |
+./spec/controllers/barcode_items_controller_spec.rb[1:1:5:1:2] | passed | 0.33273 seconds |
+./spec/controllers/barcode_items_controller_spec.rb[1:1:5:1:3:1] | passed | 0.33489 seconds |
+./spec/controllers/barcode_items_controller_spec.rb[1:1:6:1] | passed | 0.33063 seconds |
+./spec/controllers/barcode_items_controller_spec.rb[1:1:6:2] | passed | 0.16737 seconds |
+./spec/controllers/barcode_items_controller_spec.rb[1:1:6:3] | passed | 0.16864 seconds |
+./spec/controllers/barcode_items_controller_spec.rb[1:1:7:1] | passed | 0.35163 seconds |
+./spec/controllers/dashboard_controller_spec.rb[1:1:1:1] | passed | 0.18448 seconds |
+./spec/controllers/dashboard_controller_spec.rb[1:1:1:2:1] | passed | 0.31264 seconds |
+./spec/controllers/dashboard_controller_spec.rb[1:2:1] | passed | 0.30725 seconds |
+./spec/controllers/diaper_drive_participants_controller_spec.rb[1:1:1:1] | passed | 0.16785 seconds |
+./spec/controllers/diaper_drive_participants_controller_spec.rb[1:1:2:1] | passed | 0.17659 seconds |
+./spec/controllers/diaper_drive_participants_controller_spec.rb[1:1:3:1] | passed | 0.17567 seconds |
+./spec/controllers/diaper_drive_participants_controller_spec.rb[1:1:4:1] | passed | 0.1644 seconds |
+./spec/controllers/diaper_drive_participants_controller_spec.rb[1:1:5:1] | passed | 0.16312 seconds |
+./spec/controllers/diaper_drive_participants_controller_spec.rb[1:1:6:1] | passed | 0.17834 seconds |
+./spec/controllers/diaper_drive_participants_controller_spec.rb[1:1:6:2] | passed | 0.17779 seconds |
+./spec/controllers/diaper_drive_participants_controller_spec.rb[1:1:7:1] | passed | 0.15672 seconds |
+./spec/controllers/diaper_drive_participants_controller_spec.rb[1:1:7:2] | passed | 0.16274 seconds |
+./spec/controllers/diaper_drive_participants_controller_spec.rb[1:1:8:1] | passed | 0.31166 seconds |
+./spec/controllers/diaper_drive_participants_controller_spec.rb[1:2:1] | passed | 0.16492 seconds |
+./spec/controllers/distributions_controller_spec.rb[1:1:1:1] | passed | 0.19754 seconds |
+./spec/controllers/distributions_controller_spec.rb[1:1:2:1] | passed | 0.17419 seconds |
+./spec/controllers/distributions_controller_spec.rb[1:1:3:1] | passed | 0.1647 seconds |
+./spec/controllers/distributions_controller_spec.rb[1:1:4:1] | passed | 0.18246 seconds |
+./spec/controllers/distributions_controller_spec.rb[1:1:4:2] | passed | 0.20803 seconds |
+./spec/controllers/distributions_controller_spec.rb[1:1:5:1] | passed | 0.18648 seconds |
+./spec/controllers/distributions_controller_spec.rb[1:1:6:1] | passed | 0.17093 seconds |
+./spec/controllers/distributions_controller_spec.rb[1:1:7:1] | passed | 0.32401 seconds |
+./spec/controllers/distributions_controller_spec.rb[1:2:1] | passed | 0.16504 seconds |
+./spec/controllers/donation_sites_controller_spec.rb[1:1:1:1] | passed | 0.19094 seconds |
+./spec/controllers/donation_sites_controller_spec.rb[1:1:2:1] | passed | 0.17648 seconds |
+./spec/controllers/donation_sites_controller_spec.rb[1:1:3:1] | passed | 0.16409 seconds |
+./spec/controllers/donation_sites_controller_spec.rb[1:1:4:1] | passed | 0.1746 seconds |
+./spec/controllers/donation_sites_controller_spec.rb[1:1:5:1] | passed | 0.16742 seconds |
+./spec/controllers/donation_sites_controller_spec.rb[1:1:6:1] | passed | 0.32199 seconds |
+./spec/controllers/donation_sites_controller_spec.rb[1:2:1] | passed | 0.1843 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:1:1] | passed | 0.1725 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:2:1] | passed | 0.18126 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:3:1] | passed | 0.18902 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:3:2] | passed | 0.18168 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:4:1] | passed | 0.17816 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:4:2] | passed | 0.2101 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:4:3:1] | passed | 0.21035 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:4:3:2] | passed | 0.20981 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:5:1] | passed | 0.19808 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:6:1] | passed | 0.18243 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:7:1] | passed | 0.1803 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:8:1] | passed | 0.32187 seconds |
+./spec/controllers/donations_controller_spec.rb[1:1:8:2] | passed | 0.33445 seconds |
+./spec/controllers/donations_controller_spec.rb[1:2:1] | passed | 0.17651 seconds |
+./spec/controllers/donations_controller_spec.rb[1:2:2] | passed | 0.17637 seconds |
+./spec/controllers/items_controller_spec.rb[1:1:1:1] | passed | 0.1775 seconds |
+./spec/controllers/items_controller_spec.rb[1:1:2:1] | passed | 0.17239 seconds |
+./spec/controllers/items_controller_spec.rb[1:1:3:1] | passed | 0.17027 seconds |
+./spec/controllers/items_controller_spec.rb[1:1:4:1] | passed | 0.17283 seconds |
+./spec/controllers/items_controller_spec.rb[1:1:5:1] | passed | 0.1784 seconds |
+./spec/controllers/items_controller_spec.rb[1:1:6:1] | passed | 0.30628 seconds |
+./spec/controllers/items_controller_spec.rb[1:2:1] | passed | 0.16847 seconds |
+./spec/controllers/organizations_controller_spec.rb[1:1:1:1] | passed | 0.16912 seconds |
+./spec/controllers/organizations_controller_spec.rb[1:1:2:1] | passed | 0.16824 seconds |
+./spec/controllers/organizations_controller_spec.rb[1:1:3:1] | passed | 0.18626 seconds |
+./spec/controllers/organizations_controller_spec.rb[1:2:1:1] | passed | 0.16827 seconds |
+./spec/controllers/organizations_controller_spec.rb[1:2:2:1] | passed | 0.17625 seconds |
+./spec/controllers/organizations_controller_spec.rb[1:2:3:1:1] | passed | 0.31873 seconds |
+./spec/controllers/organizations_controller_spec.rb[1:2:3:2:1] | passed | 0.32635 seconds |
+./spec/controllers/partners_controller_spec.rb[1:1:1] | passed | 0.16759 seconds |
+./spec/controllers/partners_controller_spec.rb[1:2:1] | passed | 0.17497 seconds |
+./spec/controllers/partners_controller_spec.rb[1:3:1] | passed | 0.1675 seconds |
+./spec/controllers/partners_controller_spec.rb[1:4:1] | passed | 0.17018 seconds |
+./spec/controllers/partners_controller_spec.rb[1:5:1] | passed | 0.17614 seconds |
+./spec/controllers/purchases_controller_spec.rb[1:1:1:1] | passed | 0.16694 seconds |
+./spec/controllers/purchases_controller_spec.rb[1:1:2:1] | passed | 0.18023 seconds |
+./spec/controllers/purchases_controller_spec.rb[1:1:3:1] | passed | 0.19007 seconds |
+./spec/controllers/purchases_controller_spec.rb[1:1:3:2] | passed | 0.17433 seconds |
+./spec/controllers/purchases_controller_spec.rb[1:1:4:1] | passed | 0.17365 seconds |
+./spec/controllers/purchases_controller_spec.rb[1:1:4:2] | passed | 0.19507 seconds |
+./spec/controllers/purchases_controller_spec.rb[1:1:4:3:1] | passed | 0.1954 seconds |
+./spec/controllers/purchases_controller_spec.rb[1:1:4:3:2] | passed | 0.21473 seconds |
+./spec/controllers/purchases_controller_spec.rb[1:1:5:1] | passed | 0.18706 seconds |
+./spec/controllers/purchases_controller_spec.rb[1:1:6:1] | passed | 0.16758 seconds |
+./spec/controllers/purchases_controller_spec.rb[1:1:7:1] | passed | 0.18934 seconds |
+./spec/controllers/static_controller_spec.rb[1:1:1:1] | passed | 0.20265 seconds |
+./spec/controllers/static_controller_spec.rb[1:1:1:2] | passed | 0.21871 seconds |
+./spec/controllers/static_controller_spec.rb[1:1:2:1] | passed | 0.16712 seconds |
+./spec/controllers/static_controller_spec.rb[1:2:1:1] | passed | 0.19087 seconds |
+./spec/controllers/storage_locations_spec.rb[1:1:1:1] | passed | 0.1745 seconds |
+./spec/controllers/storage_locations_spec.rb[1:1:2:1] | passed | 0.19663 seconds |
+./spec/controllers/storage_locations_spec.rb[1:1:3:1] | passed | 0.19075 seconds |
+./spec/controllers/storage_locations_spec.rb[1:1:4:1] | passed | 0.16947 seconds |
+./spec/controllers/storage_locations_spec.rb[1:1:5:1] | passed | 0.17089 seconds |
+./spec/controllers/storage_locations_spec.rb[1:1:6:1] | passed | 0.32798 seconds |
+./spec/controllers/storage_locations_spec.rb[1:2:1] | passed | 0.1655 seconds |
+./spec/controllers/transfers_controller_spec.rb[1:1:1:1] | passed | 0.16892 seconds |
+./spec/controllers/transfers_controller_spec.rb[1:1:2:1] | passed | 0.19782 seconds |
+./spec/controllers/transfers_controller_spec.rb[1:1:2:2] | passed | 0.17648 seconds |
+./spec/controllers/transfers_controller_spec.rb[1:1:3:1] | passed | 0.16759 seconds |
+./spec/controllers/transfers_controller_spec.rb[1:1:4:1] | passed | 0.18096 seconds |
+./spec/controllers/transfers_controller_spec.rb[1:1:5:1] | passed | 0.32986 seconds |
+./spec/controllers/transfers_controller_spec.rb[1:2:1] | passed | 0.16456 seconds |
+./spec/controllers/users_controller_spec.rb[1:1:1] | passed | 0.18125 seconds |
+./spec/features/account_spec.rb[1:1] | passed | 0.67629 seconds |
+./spec/features/adjustment_spec.rb[1:1] | passed | 2.45 seconds |
+./spec/features/adjustment_spec.rb[1:2] | passed | 1.12 seconds |
+./spec/features/adjustment_spec.rb[1:3] | passed | 0.20899 seconds |
+./spec/features/admin/canonical_items_spec.rb[1:1:1:1] | passed | 0.20183 seconds |
+./spec/features/admin/canonical_items_spec.rb[1:1:1:2] | passed | 0.20099 seconds |
+./spec/features/admin/canonical_items_spec.rb[1:1:2:1] | passed | 0.20491 seconds |
+./spec/features/admin/canonical_items_spec.rb[1:1:2:2] | passed | 0.18933 seconds |
+./spec/features/admin/canonical_items_spec.rb[1:1:3] | passed | 0.18922 seconds |
+./spec/features/admin/canonical_items_spec.rb[1:1:4] | passed | 0.18928 seconds |
+./spec/features/admin/canonical_items_spec.rb[1:2:1] | passed | 0.32911 seconds |
+./spec/features/admin/organizations_spec.rb[1:1] | passed | 0.39629 seconds |
+./spec/features/authorization_spec.rb[1:1] | passed | 0.21091 seconds |
+./spec/features/barcode_item_spec.rb[1:1:1] | passed | 0.21752 seconds |
+./spec/features/barcode_item_spec.rb[1:1:2] | passed | 0.22131 seconds |
+./spec/features/barcode_item_spec.rb[1:2:1] | passed | 0.23738 seconds |
+./spec/features/barcode_item_spec.rb[1:2:2] | passed | 0.22985 seconds |
+./spec/features/barcode_item_spec.rb[1:2:3] | passed | 0.21491 seconds |
+./spec/features/barcode_item_spec.rb[1:3:1] | passed | 0.24964 seconds |
+./spec/features/barcode_item_spec.rb[1:4] | passed | 0.22329 seconds |
+./spec/features/barcode_item_spec.rb[1:5] | passed | 0.20387 seconds |
+./spec/features/barcode_item_spec.rb[1:6] | passed | 0.20874 seconds |
+./spec/features/dashboard_spec.rb[1:1:1] | passed | 0.24335 seconds |
+./spec/features/dashboard_spec.rb[1:2] | passed | 0.39645 seconds |
+./spec/features/dashboard_spec.rb[1:3] | passed | 4.13 seconds |
+./spec/features/dashboard_spec.rb[1:4] | passed | 1.25 seconds |
+./spec/features/diaper_drive_participant_spec.rb[1:1:1] | passed | 0.18104 seconds |
+./spec/features/diaper_drive_participant_spec.rb[1:2] | passed | 0.22303 seconds |
+./spec/features/diaper_drive_participant_spec.rb[1:3] | passed | 0.19634 seconds |
+./spec/features/diaper_drive_participant_spec.rb[1:4] | passed | 0.21396 seconds |
+./spec/features/diaper_drive_participant_spec.rb[1:5] | passed | 0.22053 seconds |
+./spec/features/diaper_drive_participant_spec.rb[1:6:1] | passed | 0.23796 seconds |
+./spec/features/diaper_drive_participant_spec.rb[1:6:2] | passed | 0.23266 seconds |
+./spec/features/distribution_spec.rb[1:1] | passed | 0.2745 seconds |
+./spec/features/distribution_spec.rb[1:2] | passed | 0.33149 seconds |
+./spec/features/distribution_spec.rb[1:3:1] | pending | 0.48185 seconds |
+./spec/features/distribution_spec.rb[1:3:2] | pending | 0.23851 seconds |
+./spec/features/donation_site_spec.rb[1:1:1] | passed | 0.214 seconds |
+./spec/features/donation_site_spec.rb[1:2] | passed | 0.23558 seconds |
+./spec/features/donation_site_spec.rb[1:3] | passed | 0.2073 seconds |
+./spec/features/donation_site_spec.rb[1:4] | passed | 0.19505 seconds |
+./spec/features/donation_site_spec.rb[1:5] | passed | 0.2344 seconds |
+./spec/features/donation_site_spec.rb[1:6] | passed | 0.23721 seconds |
+./spec/features/donation_spec.rb[1:1:1] | passed | 0.56147 seconds |
+./spec/features/donation_spec.rb[1:1:2] | passed | 0.37546 seconds |
+./spec/features/donation_spec.rb[1:2:1] | passed | 0.67498 seconds |
+./spec/features/donation_spec.rb[1:2:2] | passed | 0.688 seconds |
+./spec/features/donation_spec.rb[1:2:3] | passed | 0.65098 seconds |
+./spec/features/donation_spec.rb[1:2:4] | passed | 0.6635 seconds |
+./spec/features/donation_spec.rb[1:2:5] | passed | 1.06 seconds |
+./spec/features/donation_spec.rb[1:2:6] | passed | 1.1 seconds |
+./spec/features/donation_spec.rb[1:3:1:1] | passed | 1.1 seconds |
+./spec/features/donation_spec.rb[1:3:1:2] | passed | 1.34 seconds |
+./spec/features/donation_spec.rb[1:3:1:3] | passed | 1.21 seconds |
+./spec/features/donation_spec.rb[1:3:1:4] | passed | 1.57 seconds |
+./spec/features/donation_spec.rb[1:3:1:5] | passed | 1.16 seconds |
+./spec/features/donation_spec.rb[1:3:1:6] | passed | 1.02 seconds |
+./spec/features/donation_spec.rb[1:3:1:7] | passed | 1.02 seconds |
+./spec/features/donation_spec.rb[1:3:1:8] | passed | 1.3 seconds |
+./spec/features/donation_spec.rb[1:3:1:9] | passed | 1.57 seconds |
+./spec/features/donation_spec.rb[1:3:2:1] | passed | 1.02 seconds |
+./spec/features/donation_spec.rb[1:3:2:2] | passed | 0.72218 seconds |
+./spec/features/donation_spec.rb[1:3:2:3] | pending | 0.3297 seconds |
+./spec/features/item_spec.rb[1:1] | passed | 0.26549 seconds |
+./spec/features/item_spec.rb[1:2] | passed | 0.22178 seconds |
+./spec/features/item_spec.rb[1:3] | passed | 0.24089 seconds |
+./spec/features/item_spec.rb[1:4] | passed | 0.22425 seconds |
+./spec/features/item_spec.rb[1:5] | passed | 0.23189 seconds |
+./spec/features/item_spec.rb[1:6] | passed | 0.2193 seconds |
+./spec/features/item_spec.rb[1:7] | passed | 0.19849 seconds |
+./spec/features/item_spec.rb[1:8:1] | passed | 1.29 seconds |
+./spec/features/log_in_spec.rb[1:1:1] | passed | 0.20031 seconds |
+./spec/features/manage_spec.rb[1:1:1] | passed | 0.18503 seconds |
+./spec/features/manage_spec.rb[1:2:1] | passed | 0.1805 seconds |
+./spec/features/manage_spec.rb[1:2:2] | passed | 0.24586 seconds |
+./spec/features/manage_spec.rb[1:2:3:1] | passed | 0.21934 seconds |
+./spec/features/organization_spec.rb[1:1:1] | passed | 0.17538 seconds |
+./spec/features/organization_spec.rb[1:2:1:1] | passed | 0.24256 seconds |
+./spec/features/organization_spec.rb[1:2:2] | passed | 0.20868 seconds |
+./spec/features/partner_spec.rb[1:1:1] | passed | 0.19291 seconds |
+./spec/features/partner_spec.rb[1:2] | passed | 0.21391 seconds |
+./spec/features/partner_spec.rb[1:3] | passed | 0.21377 seconds |
+./spec/features/partner_spec.rb[1:4] | passed | 0.21047 seconds |
+./spec/features/partner_spec.rb[1:5] | passed | 0.2243 seconds |
+./spec/features/purchase_spec.rb[1:1:1] | passed | 0.59841 seconds |
+./spec/features/purchase_spec.rb[1:2:1] | passed | 0.64561 seconds |
+./spec/features/purchase_spec.rb[1:3:1:1] | passed | 1.07 seconds |
+./spec/features/purchase_spec.rb[1:3:1:2] | passed | 1.26 seconds |
+./spec/features/purchase_spec.rb[1:3:1:3] | passed | 1.6 seconds |
+./spec/features/purchase_spec.rb[1:3:2:1] | passed | 0.52078 seconds |
+./spec/features/purchase_spec.rb[1:3:3:1] | pending | 0.52161 seconds |
+./spec/features/purchase_spec.rb[1:3:3:2] | pending | 2.53 seconds |
+./spec/features/purchase_spec.rb[1:3:3:3] | pending | 0.31064 seconds |
+./spec/features/storage_location_spec.rb[1:1] | passed | 0.22948 seconds |
+./spec/features/storage_location_spec.rb[1:2] | passed | 0.19748 seconds |
+./spec/features/storage_location_spec.rb[1:3] | passed | 0.2116 seconds |
+./spec/features/storage_location_spec.rb[1:4] | passed | 0.23278 seconds |
+./spec/features/storage_location_spec.rb[1:5] | passed | 0.22284 seconds |
+./spec/features/storage_location_spec.rb[1:6] | passed | 0.21076 seconds |
+./spec/features/storage_location_spec.rb[1:7] | passed | 0.23094 seconds |
+./spec/features/storage_location_spec.rb[1:8] | passed | 0.23704 seconds |
+./spec/features/transfer_spec.rb[1:1] | passed | 0.28543 seconds |
+./spec/features/transfer_spec.rb[1:2] | passed | 0.27084 seconds |
+./spec/helpers/application_helper_spec.rb[1:1:1] | passed | 0.16897 seconds |
+./spec/helpers/application_helper_spec.rb[1:2:1:1] | passed | 0.16208 seconds |
+./spec/helpers/application_helper_spec.rb[1:2:2:1] | passed | 0.18167 seconds |
+./spec/helpers/application_helper_spec.rb[1:2:3:1] | passed | 0.16553 seconds |
+./spec/helpers/purchases_helper_spec.rb[1:1] | pending | 0.00001 seconds |
+./spec/models/adjustment_spec.rb[1:1:2:1:1] | passed | 0.17828 seconds |
+./spec/models/adjustment_spec.rb[1:1:2:1:2] | passed | 0.18636 seconds |
+./spec/models/adjustment_spec.rb[1:1:2:2:1] | passed | 0.22636 seconds |
+./spec/models/adjustment_spec.rb[1:1:2:3:1] | passed | 0.20122 seconds |
+./spec/models/adjustment_spec.rb[1:1:2:3:2] | passed | 0.20778 seconds |
+./spec/models/adjustment_spec.rb[1:1:2:4:1] | passed | 0.24782 seconds |
+./spec/models/adjustment_spec.rb[1:1:2:5:1] | passed | 0.20091 seconds |
+./spec/models/adjustment_spec.rb[1:1:2:6:1] | passed | 0.18101 seconds |
+./spec/models/adjustment_spec.rb[1:2:1] | passed | 0.17783 seconds |
+./spec/models/adjustment_spec.rb[1:3:1] | passed | 0.18245 seconds |
+./spec/models/adjustment_spec.rb[1:4:1] | passed | 0.32203 seconds |
+./spec/models/adjustment_spec.rb[1:5:1] | passed | 0.18446 seconds |
+./spec/models/barcode_item_spec.rb[1:1:1] | passed | 0.17552 seconds |
+./spec/models/barcode_item_spec.rb[1:1:2:1] | passed | 0.19143 seconds |
+./spec/models/barcode_item_spec.rb[1:1:3:1] | passed | 0.17626 seconds |
+./spec/models/barcode_item_spec.rb[1:1:4:1] | passed | 0.18806 seconds |
+./spec/models/barcode_item_spec.rb[1:1:4:2:1] | passed | 0.18071 seconds |
+./spec/models/barcode_item_spec.rb[1:1:4:3:1] | passed | 0.1673 seconds |
+./spec/models/barcode_item_spec.rb[1:1:4:3:2] | passed | 0.16427 seconds |
+./spec/models/barcode_item_spec.rb[1:1:4:3:3] | passed | 0.17458 seconds |
+./spec/models/barcode_item_spec.rb[1:1:4:4:1] | passed | 0.17538 seconds |
+./spec/models/barcode_item_spec.rb[1:1:4:4:2] | passed | 0.16717 seconds |
+./spec/models/barcode_item_spec.rb[1:2:1] | passed | 0.17899 seconds |
+./spec/models/barcode_item_spec.rb[1:2:2:1] | passed | 0.1843 seconds |
+./spec/models/barcode_item_spec.rb[1:2:3:1] | passed | 0.32803 seconds |
+./spec/models/barcode_item_spec.rb[1:2:4:1] | passed | 0.18474 seconds |
+./spec/models/barcode_item_spec.rb[1:2:4:2:1] | passed | 0.16937 seconds |
+./spec/models/barcode_item_spec.rb[1:2:4:3:1] | passed | 0.16836 seconds |
+./spec/models/barcode_item_spec.rb[1:2:4:3:2] | passed | 0.16462 seconds |
+./spec/models/barcode_item_spec.rb[1:2:4:3:3] | passed | 0.18443 seconds |
+./spec/models/barcode_item_spec.rb[1:2:4:4:1] | passed | 0.16447 seconds |
+./spec/models/barcode_item_spec.rb[1:2:4:4:2] | passed | 0.17001 seconds |
+./spec/models/barcode_item_spec.rb[1:2:5:1] | passed | 0.18505 seconds |
+./spec/models/canonical_item_spec.rb[1:1:1] | passed | 0.1636 seconds |
+./spec/models/canonical_item_spec.rb[1:1:2] | passed | 0.16185 seconds |
+./spec/models/canonical_item_spec.rb[1:1:3] | passed | 0.16209 seconds |
+./spec/models/canonical_item_spec.rb[1:2:1] | passed | 0.18581 seconds |
+./spec/models/data_export_spec.rb[1:1:1:1] | passed | 0.17981 seconds |
+./spec/models/data_export_spec.rb[1:1:2:1] | passed | 0.41551 seconds |
+./spec/models/data_export_spec.rb[1:1:3:1] | passed | 0.35979 seconds |
+./spec/models/data_export_spec.rb[1:1:4:1] | passed | 0.3291 seconds |
+./spec/models/data_export_spec.rb[1:1:5:1] | passed | 0.32567 seconds |
+./spec/models/data_export_spec.rb[1:1:6:1] | passed | 0.33179 seconds |
+./spec/models/data_export_spec.rb[1:1:7:1] | passed | 0.32313 seconds |
+./spec/models/data_export_spec.rb[1:1:8:1] | passed | 0.33915 seconds |
+./spec/models/data_export_spec.rb[1:1:9:1] | passed | 0.31769 seconds |
+./spec/models/data_export_spec.rb[1:1:10:1] | passed | 0.3154 seconds |
+./spec/models/data_export_spec.rb[1:1:11:1] | passed | 0.33113 seconds |
+./spec/models/data_export_spec.rb[1:1:12:1] | passed | 0.33197 seconds |
+./spec/models/data_export_spec.rb[1:1:13:1] | passed | 0.32991 seconds |
+./spec/models/data_export_spec.rb[1:1:14:1] | passed | 0.33179 seconds |
+./spec/models/diaper_drive_participant_spec.rb[1:1:1] | passed | 0.16941 seconds |
+./spec/models/diaper_drive_participant_spec.rb[1:1:2] | passed | 0.16462 seconds |
+./spec/models/diaper_drive_participant_spec.rb[1:1:3] | passed | 0.1632 seconds |
+./spec/models/diaper_drive_participant_spec.rb[1:2:1:1] | passed | 0.19949 seconds |
+./spec/models/diaper_drive_participant_spec.rb[1:3:1] | passed | 0.33062 seconds |
+./spec/models/diaper_drive_participant_spec.rb[1:4:1] | passed | 0.187 seconds |
+./spec/models/distribution_spec.rb[1:1:2:1:1] | passed | 0.18068 seconds |
+./spec/models/distribution_spec.rb[1:1:2:1:2] | passed | 0.20853 seconds |
+./spec/models/distribution_spec.rb[1:1:2:2:1] | passed | 0.23309 seconds |
+./spec/models/distribution_spec.rb[1:1:2:3:1] | passed | 0.19859 seconds |
+./spec/models/distribution_spec.rb[1:1:2:3:2] | passed | 0.20398 seconds |
+./spec/models/distribution_spec.rb[1:1:2:4:1] | passed | 0.22131 seconds |
+./spec/models/distribution_spec.rb[1:1:2:5:1] | passed | 0.20995 seconds |
+./spec/models/distribution_spec.rb[1:1:2:6:1] | passed | 0.1947 seconds |
+./spec/models/distribution_spec.rb[1:2:1] | passed | 0.17032 seconds |
+./spec/models/distribution_spec.rb[1:2:2] | passed | 0.1658 seconds |
+./spec/models/distribution_spec.rb[1:2:3] | passed | 0.16146 seconds |
+./spec/models/distribution_spec.rb[1:2:4] | passed | 0.18905 seconds |
+./spec/models/distribution_spec.rb[1:2:5] | passed | 0.19513 seconds |
+./spec/models/distribution_spec.rb[1:3:1:1] | passed | 0.18946 seconds |
+./spec/models/distribution_spec.rb[1:4:1] | passed | 0.17971 seconds |
+./spec/models/distribution_spec.rb[1:5:1:1] | passed | 0.17735 seconds |
+./spec/models/distribution_spec.rb[1:5:2:1] | passed | 0.20917 seconds |
+./spec/models/distribution_spec.rb[1:5:3:1] | passed | 0.21766 seconds |
+./spec/models/donation_site_spec.rb[1:1:1] | passed | 0.16058 seconds |
+./spec/models/donation_site_spec.rb[1:1:2] | passed | 0.17554 seconds |
+./spec/models/donation_site_spec.rb[1:1:3] | passed | 0.16279 seconds |
+./spec/models/donation_site_spec.rb[1:2:1] | passed | 0.33803 seconds |
+./spec/models/donation_site_spec.rb[1:3:1] | passed | 0.16375 seconds |
+./spec/models/donation_spec.rb[1:1:2:1:1] | passed | 0.17927 seconds |
+./spec/models/donation_spec.rb[1:1:2:1:2] | passed | 0.19946 seconds |
+./spec/models/donation_spec.rb[1:1:2:2:1] | passed | 0.23783 seconds |
+./spec/models/donation_spec.rb[1:1:2:3:1] | passed | 0.21971 seconds |
+./spec/models/donation_spec.rb[1:1:2:3:2] | passed | 0.20207 seconds |
+./spec/models/donation_spec.rb[1:1:2:4:1] | passed | 0.22101 seconds |
+./spec/models/donation_spec.rb[1:1:2:5:1] | passed | 0.20486 seconds |
+./spec/models/donation_spec.rb[1:1:2:6:1] | passed | 0.1957 seconds |
+./spec/models/donation_spec.rb[1:2:1] | passed | 0.17502 seconds |
+./spec/models/donation_spec.rb[1:2:2] | passed | 0.17716 seconds |
+./spec/models/donation_spec.rb[1:2:3] | passed | 0.17752 seconds |
+./spec/models/donation_spec.rb[1:2:4] | passed | 0.18208 seconds |
+./spec/models/donation_spec.rb[1:2:5] | passed | 0.17841 seconds |
+./spec/models/donation_spec.rb[1:2:6] | passed | 0.18352 seconds |
+./spec/models/donation_spec.rb[1:3:1] | passed | 0.18236 seconds |
+./spec/models/donation_spec.rb[1:3:2] | passed | 0.17713 seconds |
+./spec/models/donation_spec.rb[1:4:1:1] | passed | 0.19249 seconds |
+./spec/models/donation_spec.rb[1:4:2:1] | passed | 0.19511 seconds |
+./spec/models/donation_spec.rb[1:4:2:2] | passed | 0.1879 seconds |
+./spec/models/donation_spec.rb[1:5:1:1] | passed | 0.18325 seconds |
+./spec/models/donation_spec.rb[1:6:1:1] | passed | 0.19343 seconds |
+./spec/models/donation_spec.rb[1:6:2:1] | passed | 0.2078 seconds |
+./spec/models/donation_spec.rb[1:6:3:1] | passed | 0.19853 seconds |
+./spec/models/donation_spec.rb[1:6:3:2] | passed | 0.19508 seconds |
+./spec/models/donation_spec.rb[1:6:3:3] | passed | 0.22275 seconds |
+./spec/models/donation_spec.rb[1:6:4:1] | passed | 0.19877 seconds |
+./spec/models/donation_spec.rb[1:6:4:2] | passed | 0.19702 seconds |
+./spec/models/donation_spec.rb[1:6:4:3] | passed | 0.21801 seconds |
+./spec/models/donation_spec.rb[1:6:5:1] | passed | 0.18984 seconds |
+./spec/models/donation_spec.rb[1:6:6:1] | passed | 0.20998 seconds |
+./spec/models/donation_spec.rb[1:7:1] | passed | 0.17113 seconds |
+./spec/models/inventory_item_spec.rb[1:1:1:1] | passed | 0.16769 seconds |
+./spec/models/inventory_item_spec.rb[1:1:1:2] | passed | 0.18759 seconds |
+./spec/models/inventory_item_spec.rb[1:1:1:3] | passed | 0.17479 seconds |
+./spec/models/inventory_item_spec.rb[1:1:2] | passed | 0.16987 seconds |
+./spec/models/inventory_item_spec.rb[1:1:3] | passed | 0.16695 seconds |
+./spec/models/inventory_item_spec.rb[1:2] | passed | 0.16764 seconds |
+./spec/models/item_spec.rb[1:1:1] | passed | 0.16646 seconds |
+./spec/models/item_spec.rb[1:1:2] | passed | 0.16355 seconds |
+./spec/models/item_spec.rb[1:1:3] | passed | 0.17353 seconds |
+./spec/models/item_spec.rb[1:2:1] | passed | 0.17487 seconds |
+./spec/models/item_spec.rb[1:2:2] | passed | 0.17429 seconds |
+./spec/models/item_spec.rb[1:2:3] | passed | 0.18127 seconds |
+./spec/models/item_spec.rb[1:2:4] | passed | 0.18374 seconds |
+./spec/models/item_spec.rb[1:2:5] | passed | 0.18624 seconds |
+./spec/models/item_spec.rb[1:2:6] | passed | 0.19637 seconds |
+./spec/models/item_spec.rb[1:2:7:1] | passed | 0.17097 seconds |
+./spec/models/item_spec.rb[1:2:7:2] | passed | 0.32939 seconds |
+./spec/models/item_spec.rb[1:3:1:1] | passed | 0.1848 seconds |
+./spec/models/item_spec.rb[1:3:1:2] | passed | 0.17519 seconds |
+./spec/models/item_spec.rb[1:3:2:1] | passed | 0.17328 seconds |
+./spec/models/item_spec.rb[1:3:3:1] | passed | 0.18492 seconds |
+./spec/models/item_spec.rb[1:3:4:1] | passed | 0.19131 seconds |
+./spec/models/item_spec.rb[1:3:5:1] | passed | 0.21274 seconds |
+./spec/models/item_spec.rb[1:3:6:1] | passed | 0.17395 seconds |
+./spec/models/item_spec.rb[1:3:6:2] | passed | 0.18535 seconds |
+./spec/models/line_item_spec.rb[1:1:1] | passed | 0.17448 seconds |
+./spec/models/line_item_spec.rb[1:1:2] | passed | 0.18674 seconds |
+./spec/models/line_item_spec.rb[1:1:3] | passed | 0.22885 seconds |
+./spec/models/organization_spec.rb[1:1:1:1] | passed | 0.33634 seconds |
+./spec/models/organization_spec.rb[1:1:1:2:1] | passed | 0.33774 seconds |
+./spec/models/organization_spec.rb[1:2:1] | passed | 0.41148 seconds |
+./spec/models/organization_spec.rb[1:3:1] | passed | 0.17226 seconds |
+./spec/models/organization_spec.rb[1:4:1] | passed | 0.18392 seconds |
+./spec/models/organization_spec.rb[1:5:1] | passed | 0.32997 seconds |
+./spec/models/organization_spec.rb[1:5:2] | passed | 0.32435 seconds |
+./spec/models/organization_spec.rb[1:6:1] | passed | 0.17283 seconds |
+./spec/models/organization_spec.rb[1:6:2] | pending | 0.00001 seconds |
+./spec/models/organization_spec.rb[1:7:1] | passed | 0.18097 seconds |
+./spec/models/organization_stats_spec.rb[1:1:1:1] | passed | 0.16052 seconds |
+./spec/models/organization_stats_spec.rb[1:1:2:1] | passed | 0.16552 seconds |
+./spec/models/organization_stats_spec.rb[1:2:1:1] | passed | 0.16191 seconds |
+./spec/models/organization_stats_spec.rb[1:2:2:1] | passed | 0.17435 seconds |
+./spec/models/organization_stats_spec.rb[1:3:1:1] | passed | 0.16826 seconds |
+./spec/models/organization_stats_spec.rb[1:3:2:1] | passed | 0.17861 seconds |
+./spec/models/organization_stats_spec.rb[1:4:1:1] | passed | 0.1627 seconds |
+./spec/models/organization_stats_spec.rb[1:4:2:1] | passed | 0.18351 seconds |
+./spec/models/organization_stats_spec.rb[1:4:3:1] | passed | 0.16098 seconds |
+./spec/models/partner_spec.rb[1:1:1] | passed | 0.16381 seconds |
+./spec/models/partner_spec.rb[1:1:2] | passed | 0.172 seconds |
+./spec/models/partner_spec.rb[1:1:3] | passed | 0.17102 seconds |
+./spec/models/partner_spec.rb[1:2:1] | passed | 0.36018 seconds |
+./spec/models/partner_spec.rb[1:2:2] | passed | 0.45554 seconds |
+./spec/models/purchase_spec.rb[1:1:2:1:1] | passed | 0.19123 seconds |
+./spec/models/purchase_spec.rb[1:1:2:1:2] | passed | 0.1932 seconds |
+./spec/models/purchase_spec.rb[1:1:2:2:1] | passed | 0.21478 seconds |
+./spec/models/purchase_spec.rb[1:1:2:3:1] | passed | 0.19934 seconds |
+./spec/models/purchase_spec.rb[1:1:2:3:2] | passed | 0.20501 seconds |
+./spec/models/purchase_spec.rb[1:1:2:4:1] | passed | 0.21957 seconds |
+./spec/models/purchase_spec.rb[1:1:2:5:1] | passed | 0.20912 seconds |
+./spec/models/purchase_spec.rb[1:1:2:6:1] | passed | 0.18942 seconds |
+./spec/models/purchase_spec.rb[1:2:1] | passed | 0.17775 seconds |
+./spec/models/purchase_spec.rb[1:2:2] | passed | 0.15857 seconds |
+./spec/models/purchase_spec.rb[1:2:3] | passed | 0.17417 seconds |
+./spec/models/purchase_spec.rb[1:3:1] | passed | 0.17503 seconds |
+./spec/models/purchase_spec.rb[1:3:2] | passed | 0.19206 seconds |
+./spec/models/purchase_spec.rb[1:4:1:1] | passed | 0.18257 seconds |
+./spec/models/purchase_spec.rb[1:5:1:1] | passed | 0.17611 seconds |
+./spec/models/purchase_spec.rb[1:6:1:1] | passed | 0.18139 seconds |
+./spec/models/purchase_spec.rb[1:6:2:1] | passed | 0.20249 seconds |
+./spec/models/purchase_spec.rb[1:6:3:1] | passed | 0.19107 seconds |
+./spec/models/purchase_spec.rb[1:6:3:2] | passed | 0.18998 seconds |
+./spec/models/purchase_spec.rb[1:6:3:3] | passed | 0.20118 seconds |
+./spec/models/purchase_spec.rb[1:6:4:1] | passed | 0.20522 seconds |
+./spec/models/purchase_spec.rb[1:6:4:2] | passed | 0.20667 seconds |
+./spec/models/purchase_spec.rb[1:6:5:1] | passed | 0.18863 seconds |
+./spec/models/storage_location_spec.rb[1:1:1] | passed | 0.16234 seconds |
+./spec/models/storage_location_spec.rb[1:1:2] | passed | 0.17429 seconds |
+./spec/models/storage_location_spec.rb[1:2:1] | passed | 0.20673 seconds |
+./spec/models/storage_location_spec.rb[1:3:1:1] | passed | 0.18344 seconds |
+./spec/models/storage_location_spec.rb[1:3:2:1] | passed | 0.18883 seconds |
+./spec/models/storage_location_spec.rb[1:3:3:1] | passed | 0.18178 seconds |
+./spec/models/storage_location_spec.rb[1:3:4:1] | passed | 0.17864 seconds |
+./spec/models/storage_location_spec.rb[1:3:5:1] | passed | 0.20377 seconds |
+./spec/models/storage_location_spec.rb[1:3:5:2] | passed | 0.21376 seconds |
+./spec/models/storage_location_spec.rb[1:3:6:1] | passed | 0.20651 seconds |
+./spec/models/storage_location_spec.rb[1:3:7:1:1] | passed | 0.20919 seconds |
+./spec/models/storage_location_spec.rb[1:3:7:1:2] | passed | 0.21217 seconds |
+./spec/models/storage_location_spec.rb[1:3:7:2:1] | passed | 0.21892 seconds |
+./spec/models/storage_location_spec.rb[1:3:8:1] | passed | 0.19209 seconds |
+./spec/models/storage_location_spec.rb[1:3:8:2] | passed | 0.19729 seconds |
+./spec/models/storage_location_spec.rb[1:3:9:1] | passed | 0.33403 seconds |
+./spec/models/storage_location_spec.rb[1:3:10:1] | passed | 0.56956 seconds |
+./spec/models/storage_location_spec.rb[1:3:11:1] | passed | 0.2057 seconds |
+./spec/models/storage_location_spec.rb[1:3:11:2] | passed | 0.18533 seconds |
+./spec/models/storage_location_spec.rb[1:3:12:1] | passed | 0.20403 seconds |
+./spec/models/storage_location_spec.rb[1:3:12:2] | passed | 0.20359 seconds |
+./spec/models/storage_location_spec.rb[1:3:13:1] | passed | 0.21026 seconds |
+./spec/models/storage_location_spec.rb[1:3:13:2] | passed | 0.21303 seconds |
+./spec/models/storage_location_spec.rb[1:3:14:1] | passed | 0.18336 seconds |
+./spec/models/transfer_spec.rb[1:1:2:1:1] | passed | 0.19963 seconds |
+./spec/models/transfer_spec.rb[1:1:2:1:2] | passed | 0.19798 seconds |
+./spec/models/transfer_spec.rb[1:1:2:2:1] | passed | 0.22509 seconds |
+./spec/models/transfer_spec.rb[1:1:2:3:1] | passed | 0.213 seconds |
+./spec/models/transfer_spec.rb[1:1:2:3:2] | passed | 0.20046 seconds |
+./spec/models/transfer_spec.rb[1:1:2:4:1] | passed | 0.22079 seconds |
+./spec/models/transfer_spec.rb[1:1:2:5:1] | passed | 0.21373 seconds |
+./spec/models/transfer_spec.rb[1:1:2:6:1] | passed | 0.18689 seconds |
+./spec/models/transfer_spec.rb[1:2:1] | passed | 0.16934 seconds |
+./spec/models/transfer_spec.rb[1:3:1] | passed | 0.1835 seconds |
+./spec/models/transfer_spec.rb[1:3:2] | passed | 0.17538 seconds |
+./spec/models/transfer_spec.rb[1:4:1] | passed | 0.32712 seconds |
+./spec/models/user_spec.rb[1:1:1] | passed | 0.17703 seconds |
+./spec/models/user_spec.rb[1:1:2] | passed | 0.16242 seconds |
diff --git a/spec/factories/adjustments.rb b/spec/factories/adjustments.rb
index daf10ba3fc..170133c39f 100644
--- a/spec/factories/adjustments.rb
+++ b/spec/factories/adjustments.rb
@@ -2,7 +2,7 @@
#
# Table name: adjustments
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# organization_id :integer
# storage_location_id :integer
# comment :text
diff --git a/spec/factories/barcode_items.rb b/spec/factories/barcode_items.rb
index 1b505e356d..09383570d5 100644
--- a/spec/factories/barcode_items.rb
+++ b/spec/factories/barcode_items.rb
@@ -2,7 +2,7 @@
#
# Table name: barcode_items
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# value :string
# barcodeable_id :integer
# quantity :integer
diff --git a/spec/factories/diaper_drive_participants.rb b/spec/factories/diaper_drive_participants.rb
index 441e2768f7..8fe15c87f4 100644
--- a/spec/factories/diaper_drive_participants.rb
+++ b/spec/factories/diaper_drive_participants.rb
@@ -2,7 +2,7 @@
#
# Table name: diaper_drive_participants
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# contact_name :string
# email :string
# phone :string
@@ -12,6 +12,8 @@
# updated_at :datetime not null
# address :string
# business_name :string
+# latitude :float
+# longitude :float
#
FactoryBot.define do
diff --git a/spec/factories/distributions.rb b/spec/factories/distributions.rb
index 115735a4d2..e4f4f17070 100644
--- a/spec/factories/distributions.rb
+++ b/spec/factories/distributions.rb
@@ -2,7 +2,7 @@
#
# Table name: distributions
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# comment :text
# created_at :datetime
# updated_at :datetime
diff --git a/spec/factories/donations.rb b/spec/factories/donations.rb
index 1305f61184..d165ecfc1d 100644
--- a/spec/factories/donations.rb
+++ b/spec/factories/donations.rb
@@ -2,7 +2,7 @@
#
# Table name: donations
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# source :string
# donation_site_id :integer
# created_at :datetime
@@ -12,6 +12,7 @@
# organization_id :integer
# diaper_drive_participant_id :integer
# issued_at :datetime
+# money_raised :integer
#
FactoryBot.define do
diff --git a/spec/factories/inventory_items.rb b/spec/factories/inventory_items.rb
index 3b3aec220b..ae4d3f909e 100644
--- a/spec/factories/inventory_items.rb
+++ b/spec/factories/inventory_items.rb
@@ -2,10 +2,10 @@
#
# Table name: inventory_items
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# storage_location_id :integer
# item_id :integer
-# quantity :integer
+# quantity :integer default(0)
# created_at :datetime
# updated_at :datetime
#
diff --git a/spec/factories/items.rb b/spec/factories/items.rb
index c9afdb213b..1787ea00ba 100644
--- a/spec/factories/items.rb
+++ b/spec/factories/items.rb
@@ -2,7 +2,7 @@
#
# Table name: items
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# name :string
# category :string
# created_at :datetime
diff --git a/spec/factories/line_items.rb b/spec/factories/line_items.rb
index 043e514c75..2423cd08cb 100644
--- a/spec/factories/line_items.rb
+++ b/spec/factories/line_items.rb
@@ -2,7 +2,7 @@
#
# Table name: line_items
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# quantity :integer
# item_id :integer
# itemizable_id :integer
diff --git a/spec/factories/organizations.rb b/spec/factories/organizations.rb
index 96ad6040e6..048cf9934b 100644
--- a/spec/factories/organizations.rb
+++ b/spec/factories/organizations.rb
@@ -2,7 +2,7 @@
#
# Table name: organizations
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# name :string
# short_name :string
# email :string
@@ -14,8 +14,9 @@
# city :string
# state :string
# zipcode :string
-# latitude :flaot
+# latitude :float
# longitude :float
+#
FactoryBot.define do
factory :organization do
diff --git a/spec/factories/partners.rb b/spec/factories/partners.rb
index 781b5846e3..63ab754fac 100644
--- a/spec/factories/partners.rb
+++ b/spec/factories/partners.rb
@@ -2,12 +2,13 @@
#
# Table name: partners
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# name :string
# email :string
# created_at :datetime
# updated_at :datetime
# organization_id :integer
+# status :string
#
FactoryBot.define do
diff --git a/spec/factories/storage_locations.rb b/spec/factories/storage_locations.rb
index 733a424a43..7b5b2377bb 100644
--- a/spec/factories/storage_locations.rb
+++ b/spec/factories/storage_locations.rb
@@ -2,12 +2,14 @@
#
# Table name: storage_locations
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# name :string
# address :string
# created_at :datetime
# updated_at :datetime
# organization_id :integer
+# latitude :float
+# longitude :float
#
FactoryBot.define do
diff --git a/spec/factories/transfers.rb b/spec/factories/transfers.rb
index a3051e7d60..8496249453 100644
--- a/spec/factories/transfers.rb
+++ b/spec/factories/transfers.rb
@@ -2,7 +2,7 @@
#
# Table name: transfers
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# from_id :integer
# to_id :integer
# comment :string
diff --git a/spec/factories/users.rb b/spec/factories/users.rb
index cc183ac713..92b8ac41ee 100644
--- a/spec/factories/users.rb
+++ b/spec/factories/users.rb
@@ -2,7 +2,7 @@
#
# Table name: users
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# email :string default(""), not null
# encrypted_password :string default(""), not null
# reset_password_token :string
@@ -26,6 +26,7 @@
# invitations_count :integer default(0)
# organization_admin :boolean
# name :string default("CHANGEME"), not null
+# super_admin :boolean default(FALSE)
#
FactoryBot.define do
@@ -37,7 +38,13 @@
organization { Organization.try(:first) || create(:organization) }
factory :organization_admin do
+ name "Very Organized Admin"
organization_admin true
end
+
+ factory :super_admin do
+ name "Administrative User"
+ super_admin true
+ end
end
end
diff --git a/spec/features/admin/admin_namespace_spec.rb b/spec/features/admin/admin_namespace_spec.rb
new file mode 100644
index 0000000000..8a9630bfaf
--- /dev/null
+++ b/spec/features/admin/admin_namespace_spec.rb
@@ -0,0 +1,19 @@
+RSpec.feature "Admin Namespace" do
+ context "While signed in as an admin user" do
+ before do
+ sign_in(@super_admin)
+ end
+ end
+
+ context "While signed in as a normal user" do
+ before do
+ sign_in(@user)
+ end
+ end
+
+ context "While signed in as an organizational admin" do
+ before do
+ sign_in(@organization_admin)
+ end
+ end
+end
\ No newline at end of file
diff --git a/spec/features/admin/barcode_items_spec.rb b/spec/features/admin/barcode_items_spec.rb
new file mode 100644
index 0000000000..542667f9de
--- /dev/null
+++ b/spec/features/admin/barcode_items_spec.rb
@@ -0,0 +1,2 @@
+RSpec.feature "Barcode Items Admin" do
+end
\ No newline at end of file
diff --git a/spec/features/admin/canonical_items_spec.rb b/spec/features/admin/canonical_items_spec.rb
new file mode 100644
index 0000000000..c837b0949a
--- /dev/null
+++ b/spec/features/admin/canonical_items_spec.rb
@@ -0,0 +1,82 @@
+RSpec.feature "Canonical Item Admin" do
+ context "While signed in as an organizationl admin" do
+ before do
+ sign_in(@super_admin)
+ end
+
+ let!(:url_prefix) {}
+ context "when creating a new canonical item" do
+ before do
+ visit new_admin_canonical_item_path
+ end
+
+ let(:canonical_item_traits) { attributes_for(:canonical_item) }
+
+ scenario "it succeeds when creating a new canonical item with good data" do
+ fill_in "Name", with: canonical_item_traits[:name]
+ fill_in "Category", with: canonical_item_traits[:category]
+ click_button "Create Canonical Item"
+
+ expect(page.find(".alert")).to have_content "added"
+ end
+
+ scenario "it fails when creating a new canonical item with empty attributes" do
+ click_button "Create Canonical Item"
+ expect(page.find(".alert")).to have_content "ailed"
+ end
+ end
+
+ context "when updating an existing canonical item" do
+ before do
+ visit edit_admin_canonical_item_path(canonical_item)
+ end
+ let(:canonical_item) { CanonicalItem.first }
+
+ scenario "succeeds when changing the name" do
+ fill_in "Name", with: canonical_item.name + " new"
+ click_button "Update Canonical Item"
+ expect(page.find(".alert")).to have_content "pdated"
+ end
+
+ scenario "fails when updating the name to empty" do
+ fill_in "Name", with: ""
+ click_button "Update Canonical Item"
+ expect(page.find(".alert")).to have_content "ailed"
+ end
+ end
+
+ scenario "viewing a listing of all Canonical Items that shows a summary of its sub-items" do
+ canonical_item = CanonicalItem.first
+ create_list(:item, 2, canonical_item: canonical_item)
+ count = canonical_item.item_count
+ visit admin_canonical_items_path
+ expect(page).to have_content(canonical_item.name)
+ within "table tbody tr#canonical-item-row-#{canonical_item.to_param} td:nth-child(3)" do
+ expect(page).to have_content(count)
+ end
+ end
+
+ scenario "viewing a single Canonical Item" do
+ canonical_item = CanonicalItem.first
+ visit admin_canonical_item_path(canonical_item)
+ expect(page).to have_content(canonical_item.name)
+ end
+ end
+
+ context "While signed in as a normal user" do
+ before do
+ sign_in(@user)
+ end
+ scenario "A normal user can't see anything" do
+ visit new_admin_canonical_item_path
+ expect(page).to have_content("Access Denied")
+ visit admin_canonical_items_path
+ expect(page).to have_content("Access Denied")
+ canonical_item = create(:canonical_item)
+ visit admin_canonical_item_path(canonical_item)
+ expect(page).to have_content("Access Denied")
+ visit edit_admin_canonical_item_path(canonical_item)
+ expect(page).to have_content("Access Denied")
+ end
+ end
+end
\ No newline at end of file
diff --git a/spec/features/admin/organizations_spec.rb b/spec/features/admin/organizations_spec.rb
new file mode 100644
index 0000000000..a7164e0739
--- /dev/null
+++ b/spec/features/admin/organizations_spec.rb
@@ -0,0 +1,34 @@
+RSpec.feature "Organizations Admin" do
+ before :each do
+ sign_in(@super_admin)
+ end
+
+ scenario "creating a new organization" do
+ visit new_admin_organization_path
+ screenshot_and_open_image
+ click_link "Add New Organization"
+ org_params = attributes_for(:organization)
+ fill_in "Name", with: org_params[:name]
+ fill_in "Short name", with: org_params[:short_name]
+ fill_in "Url", with: org_params[:url]
+ fill_in "Email", with: org_params[:email]
+ fill_in "Street", with: "1234 Banana Drive"
+ fill_in "City", with: "Boston"
+ select("MA", from: "State")
+ fill_in "Zipcode", with: "12345"
+
+ click_on "Create"
+
+ expect(page).to have_content("All Diaperbase Organizations")
+
+ within("tr.#{org_params[:short_name]}") do
+ first(:link, "View").click
+ end
+
+ expect(page).to have_content(org_params[:name])
+ expect(page).to have_content("Banana")
+ expect(page).to have_content("Boston")
+ expect(page).to have_content("MA")
+ expect(page).to have_content("12345")
+ end
+end
\ No newline at end of file
diff --git a/spec/features/admin/users_spec.rb b/spec/features/admin/users_spec.rb
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/spec/features/admins_spec.rb b/spec/features/admins_spec.rb
deleted file mode 100644
index 28eaa2a79f..0000000000
--- a/spec/features/admins_spec.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-RSpec.feature "Site Administration", type: :feature do
- before do
- sign_in(@organization_admin)
- visit "/admins"
- end
-
- scenario "Admin can create a new organization" do
- click_link "Add New Organization"
- org_params = attributes_for(:organization)
- fill_in "Name", with: org_params[:name]
- fill_in "Short name", with: org_params[:short_name]
- fill_in "Url", with: org_params[:url]
- fill_in "Email", with: org_params[:email]
- fill_in "Street", with: "1234 Banana Drive"
- fill_in "City", with: "Boston"
- select("MA", from: "State")
- fill_in "Zipcode", with: "12345"
-
- click_button "Create"
-
- expect(page).to have_content("All Diaperbase Organizations")
-
- within("tr", text: org_params[:name]) do
- first(:link, "View").click
- end
-
- expect(page).to have_content(org_params[:name])
- expect(page).to have_content("Banana")
- expect(page).to have_content("Boston")
- expect(page).to have_content("MA")
- expect(page).to have_content("12345")
- end
-
- scenario "Admin can bail back to their own site" do
- expect(page).to have_xpath("//a[@href='#{dashboard_path(organization_id: @organization.to_param)}']")
- end
-
- scenario "An admin can edit the properties for an organization" do
- click_link "Edit"
- fill_in "Name", with: "Something else"
- click_button "Update"
- expect(page).to have_content("pdated organization")
- expect(page).to have_content("Something else")
- end
-
- context "When looking at a single organization" do
- before do
- @organization.users << create(:user, email: "yet_another_user@website.com")
- visit admin_path(@organization.id)
- end
- scenario "Admin can view details about an organization, including the users" do
- expect(page).to have_content(@organization.email)
- expect(page).to have_content(@organization.address)
- @organization.users.each do |u|
- expect(page).to have_content(u.email)
- end
- end
-
- scenario "An admin can add a new user to an organization" do
- page.find("a", text: "Invite User to this Organization").click
- allow(User).to receive(:invite!).and_return(true)
- within "#addUserModal" do
- fill_in "email", with: "some_new_user@website.com"
- click_button "Invite User"
- end
- expect(page).to have_content("invited to organization")
- end
- end
-end
diff --git a/spec/features/authorization_spec.rb b/spec/features/authorization_spec.rb
index 27ba2f68c4..ae324d831a 100644
--- a/spec/features/authorization_spec.rb
+++ b/spec/features/authorization_spec.rb
@@ -1,7 +1,7 @@
RSpec.feature "Authorization", type: :feature do
scenario "should redirect to dashboard when unauthorized user attempts access" do
sign_in(@user)
- visit "/admins"
+ visit "/admin/dashboard"
expect(page.find("h1")).to have_content "Dashboard"
expect(page.find(".alert")).to have_content "Access Denied"
end
diff --git a/spec/features/canonical_item_spec.rb b/spec/features/canonical_item_spec.rb
deleted file mode 100644
index e507464e91..0000000000
--- a/spec/features/canonical_item_spec.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-RSpec.feature "Canonical Item management", type: :feature do
- context "While signed in as an organizationl admin" do
- before do
- sign_in(@organization_admin)
- end
-
- let!(:url_prefix) {}
- scenario "Admin can create a new canonical item" do
- visit "/canonical_items/new"
- canonical_item_traits = attributes_for(:canonical_item)
- fill_in "Name", with: canonical_item_traits[:name]
- fill_in "Category", with: canonical_item_traits[:category]
- click_button "Create Canonical Item"
-
- expect(page.find(".alert")).to have_content "added"
- end
-
- scenario "Admin creates a new canonical item with empty attributes" do
- visit "/canonical_items/new"
- click_button "Create Canonical Item"
-
- expect(page.find(".alert")).to have_content "ailed"
- end
-
- scenario "Admin updates an existing canonical item" do
- canonical_item = CanonicalItem.first
- visit "/canonical_items/#{canonical_item.to_param}/edit"
- fill_in "Name", with: canonical_item.name + " new"
- click_button "Update Canonical Item"
- expect(page.find(".alert")).to have_content "pdated"
- end
-
- scenario "Admin updates an existing item with empty attributes" do
- canonical_item = CanonicalItem.first
- visit "/canonical_items/#{canonical_item.to_param}/edit"
- fill_in "Name", with: ""
- click_button "Update Canonical Item"
- expect(page.find(".alert")).to have_content "ailed"
- end
-
- scenario "Admin can see a listing of all Canonical Items that shows a summary of its sub-items" do
- canonical_item = CanonicalItem.first
- create_list(:item, 2, canonical_item: canonical_item)
- count = canonical_item.item_count
- visit "/canonical_items"
- expect(page).to have_content(canonical_item.name)
- within "table tbody tr#canonical-item-row-#{canonical_item.to_param} td:nth-child(3)" do
- expect(page).to have_content(count)
- end
- end
-
- scenario "Admin can view a single Canonical Item" do
- canonical_item = CanonicalItem.first
- visit "/canonical_items/#{canonical_item.to_param}"
- expect(page).to have_content(canonical_item.name)
- end
- end
-
- context "While signed in as a normal user" do
- before do
- sign_in(@user)
- end
- scenario "A normal user can't see anything" do
- visit "/canonical_items/new"
- expect(page).to have_content("Access Denied")
- visit "/canonical_items/index"
- expect(page).to have_content("Access Denied")
- canonical_item = create(:canonical_item)
- visit "/canonical_items/#{canonical_item.id}"
- expect(page).to have_content("Access Denied")
- visit "/canonical_items/#{canonical_item.id}/edit"
- expect(page).to have_content("Access Denied")
- end
- end
-end
diff --git a/spec/features/manage_spec.rb b/spec/features/manage_spec.rb
new file mode 100644
index 0000000000..36b6403eb8
--- /dev/null
+++ b/spec/features/manage_spec.rb
@@ -0,0 +1,45 @@
+RSpec.feature "Organization Administration", type: :feature do
+ subject { "/#{@organization.to_param}/organization" }
+ context "while signed in as a normal user" do
+ before do
+ sign_in(@user)
+ visit subject
+ end
+
+ scenario "the user does not see an edit link" do
+ expect(page).not_to have_link("Edit")
+ end
+ end
+ context "while signed in as an organization admin" do
+ before do
+ sign_in(@organization_admin)
+ visit subject
+ end
+
+ scenario "the user can bail back to their own site" do
+ expect(page).to have_xpath("//a[@href='#{dashboard_path(organization_id: @organization.to_param)}']")
+ end
+
+ scenario "An admin can edit the properties for an organization" do
+ click_on "Edit"
+ fill_in "Name", with: "Something else"
+ click_button "Update"
+ expect(page).to have_content("pdated your organization")
+ expect(page).to have_content("Something else")
+ end
+
+ context "When looking at a single organization" do
+ before do
+ @organization.users << create(:user, email: "yet_another_user@website.com")
+ visit subject
+ end
+ scenario "Admin can view details about an organization, including the users" do
+ expect(page).to have_content(@organization.email)
+ expect(page).to have_content(@organization.address)
+ @organization.users.each do |u|
+ expect(page).to have_content(u.email)
+ end
+ end
+ end
+ end
+end
diff --git a/spec/features/organization_spec.rb b/spec/features/organization_spec.rb
index a3b7d9de4e..9d141287ab 100644
--- a/spec/features/organization_spec.rb
+++ b/spec/features/organization_spec.rb
@@ -1,15 +1,43 @@
RSpec.feature "Organization management", type: :feature do
- before do
- sign_in(@user)
- end
let!(:url_prefix) { "/#{@organization.to_param}" }
- scenario "When editing their organization, the user is prompted with placeholder text and a more helpful error message to ensure correct URL format" do
- visit url_prefix + "/organization/edit"
- fill_in "Url", with: "www.diaperbase.com"
- click_button "Update"
-
- fill_in "Url", with: "http://www.diaperbase.com"
- click_button "Update"
- expect(page.find(".alert")).to have_content "pdated"
+
+ context "while signed in as a normal user" do
+ before do
+ sign_in(@user)
+ end
+
+ scenario "The user can see summary details about the organization" do
+ visit url_prefix + "/organization"
+ end
+ end
+ context "while signed in as an organization admin" do
+ before do
+ sign_in(@organization_admin)
+ end
+
+ describe "Editing the organization" do
+ before do
+ visit url_prefix + "/manage/edit"
+ end
+ scenario "the user is prompted with placeholder text and a more helpful error message to ensure correct URL format" do
+ fill_in "Url", with: "www.diaperbase.com"
+ click_on "Update"
+
+ fill_in "Url", with: "http://www.diaperbase.com"
+ click_on "Update"
+ expect(page.find(".alert")).to have_content "pdated"
+ end
+ end
+
+ scenario "Adding a new user to an organization" do
+ allow(User).to receive(:invite!).and_return(true)
+ visit url_prefix + "/organization"
+ click_on "Invite User to this Organization"
+ within "#addUserModal" do
+ fill_in "email", with: "some_new_user@website.com"
+ click_on "Invite User"
+ end
+ expect(page).to have_content("invited to organization")
+ end
end
end
diff --git a/spec/models/adjustment_spec.rb b/spec/models/adjustment_spec.rb
index 78507aa93e..a507c1eb05 100644
--- a/spec/models/adjustment_spec.rb
+++ b/spec/models/adjustment_spec.rb
@@ -2,7 +2,7 @@
#
# Table name: adjustments
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# organization_id :integer
# storage_location_id :integer
# comment :text
diff --git a/spec/models/barcode_item_spec.rb b/spec/models/barcode_item_spec.rb
index c8bc59db3b..68994321e3 100644
--- a/spec/models/barcode_item_spec.rb
+++ b/spec/models/barcode_item_spec.rb
@@ -2,7 +2,7 @@
#
# Table name: barcode_items
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# value :string
# barcodeable_id :integer
# quantity :integer
@@ -12,6 +12,7 @@
# global :boolean default(FALSE)
# barcodeable_type :string default("Item")
#
+
RSpec.shared_examples "common barcode tests" do |barcode_item_factory|
describe "item >" do
it "is invalid without an item associated with it" do
diff --git a/spec/models/diaper_drive_participant_spec.rb b/spec/models/diaper_drive_participant_spec.rb
index 9607537443..4f8d6fdacd 100644
--- a/spec/models/diaper_drive_participant_spec.rb
+++ b/spec/models/diaper_drive_participant_spec.rb
@@ -2,7 +2,7 @@
#
# Table name: diaper_drive_participants
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# contact_name :string
# email :string
# phone :string
@@ -14,6 +14,7 @@
# business_name :string
# latitude :float
# longitude :float
+#
require "rails_helper"
diff --git a/spec/models/distribution_spec.rb b/spec/models/distribution_spec.rb
index e15508df91..ef864d1fb8 100644
--- a/spec/models/distribution_spec.rb
+++ b/spec/models/distribution_spec.rb
@@ -2,7 +2,7 @@
#
# Table name: distributions
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# comment :text
# created_at :datetime
# updated_at :datetime
diff --git a/spec/models/donation_site_spec.rb b/spec/models/donation_site_spec.rb
index 3a78ce1d9e..58fc7a1990 100644
--- a/spec/models/donation_site_spec.rb
+++ b/spec/models/donation_site_spec.rb
@@ -2,7 +2,7 @@
#
# Table name: donation_sites
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# name :string
# address :string
# created_at :datetime
diff --git a/spec/models/donation_spec.rb b/spec/models/donation_spec.rb
index 12b0774766..a13a5328fa 100644
--- a/spec/models/donation_spec.rb
+++ b/spec/models/donation_spec.rb
@@ -2,7 +2,7 @@
#
# Table name: donations
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# source :string
# donation_site_id :integer
# created_at :datetime
@@ -12,6 +12,7 @@
# organization_id :integer
# diaper_drive_participant_id :integer
# issued_at :datetime
+# money_raised :integer
#
RSpec.describe Donation, type: :model do
diff --git a/spec/models/inventory_item_spec.rb b/spec/models/inventory_item_spec.rb
index a70e686b03..c4e4ca7c04 100644
--- a/spec/models/inventory_item_spec.rb
+++ b/spec/models/inventory_item_spec.rb
@@ -2,10 +2,10 @@
#
# Table name: inventory_items
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# storage_location_id :integer
# item_id :integer
-# quantity :integer
+# quantity :integer default(0)
# created_at :datetime
# updated_at :datetime
#
diff --git a/spec/models/item_spec.rb b/spec/models/item_spec.rb
index 812c4fc7fb..1c55b02327 100644
--- a/spec/models/item_spec.rb
+++ b/spec/models/item_spec.rb
@@ -2,7 +2,7 @@
#
# Table name: items
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# name :string
# category :string
# created_at :datetime
diff --git a/spec/models/line_item_spec.rb b/spec/models/line_item_spec.rb
index c2b595bede..d4401569b4 100644
--- a/spec/models/line_item_spec.rb
+++ b/spec/models/line_item_spec.rb
@@ -2,7 +2,7 @@
#
# Table name: line_items
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# quantity :integer
# item_id :integer
# itemizable_id :integer
diff --git a/spec/models/organization_spec.rb b/spec/models/organization_spec.rb
index 4e9a737c17..56a214d99c 100644
--- a/spec/models/organization_spec.rb
+++ b/spec/models/organization_spec.rb
@@ -2,7 +2,7 @@
#
# Table name: organizations
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# name :string
# short_name :string
# email :string
diff --git a/spec/models/partner_spec.rb b/spec/models/partner_spec.rb
index 5a0c25f254..eb79ebad0b 100644
--- a/spec/models/partner_spec.rb
+++ b/spec/models/partner_spec.rb
@@ -2,12 +2,13 @@
#
# Table name: partners
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# name :string
# email :string
# created_at :datetime
# updated_at :datetime
# organization_id :integer
+# status :string
#
RSpec.describe Partner, type: :model do
diff --git a/spec/models/storage_location_spec.rb b/spec/models/storage_location_spec.rb
index 7c2b659405..83fce905c1 100644
--- a/spec/models/storage_location_spec.rb
+++ b/spec/models/storage_location_spec.rb
@@ -2,7 +2,7 @@
#
# Table name: storage_locations
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# name :string
# address :string
# created_at :datetime
diff --git a/spec/models/transfer_spec.rb b/spec/models/transfer_spec.rb
index cb749b7971..77e15325b6 100644
--- a/spec/models/transfer_spec.rb
+++ b/spec/models/transfer_spec.rb
@@ -2,7 +2,7 @@
#
# Table name: transfers
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# from_id :integer
# to_id :integer
# comment :string
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 3b7635dbaa..325b7ba680 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -2,7 +2,7 @@
#
# Table name: users
#
-# id :bigint(8) not null, primary key
+# id :integer not null, primary key
# email :string default(""), not null
# encrypted_password :string default(""), not null
# reset_password_token :string
@@ -26,6 +26,7 @@
# invitations_count :integer default(0)
# organization_admin :boolean
# name :string default("CHANGEME"), not null
+# super_admin :boolean default(FALSE)
#
RSpec.describe User, type: :model do
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 375afd3f1b..c9ae0492a1 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -7,6 +7,7 @@
require "rspec/rails"
require "capybara/rails"
require "capybara/rspec"
+require "capybara-screenshot/rspec"
require "pry"
# Add additional requires below this line. Rails is not loaded until this point!
@@ -44,6 +45,18 @@
# Enable JS for Capybara tests
Capybara.javascript_driver = :chrome
+Capybara::Screenshot.autosave_on_failure = true
+# The driver name should match the Capybara driver config name.
+Capybara::Screenshot.register_driver(:chrome) do |driver, path|
+ driver.browser.save_screenshot(path)
+end
+
+# Set the asset host so that the screenshots look nice
+Capybara.asset_host = "http://localhost:3000"
+
+# Only keep the most recent run
+Capybara::Screenshot.prune_strategy = :keep_last_run
+
RSpec.configure do |config|
config.include Devise::Test::ControllerHelpers, type: :controller
config.include Devise::Test::ControllerHelpers, type: :view
@@ -57,6 +70,9 @@
# Location for fixtures (logo, etc)
config.fixture_path = "#{::Rails.root}/spec/fixtures"
+ # Persistence for failures
+ config.example_status_persistence_file_path = "spec/example_failures.txt"
+
# Make FactoryBot easier.
config.include FactoryBot::Syntax::Methods
@@ -94,10 +110,12 @@
# prepare a default @organization and @user to always be available for testing
Rails.logger.info "\n\n-~=> Creating DEFAULT organization"
@organization = create(:organization, name: "DEFAULT")
- Rails.logger.info "\n\n-~=> Creating DEFAULT admin & user"
- @organization_admin = create(:organization_admin, name: "DEFAULT ADMIN")
+ Rails.logger.info "\n\n-~=> Creating DEFAULT admins & user"
+ @organization_admin = create(:organization_admin, name: "DEFAULT ORG ADMIN", organization: @organization)
@user = create(:user, organization: @organization, name: "DEFAULT USER")
+ @super_admin = create(:super_admin, name: "DEFAULT SUPERADMIN")
+ # Print the name of the example being run
Rails.logger.info "\n\n-~=> #{self.class.description} ::::::::::::::::::::::"
end
@@ -109,16 +127,6 @@
# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and
# `post` in specs under `spec/controllers`.
- #
- # You can disable this behaviour by removing the line below, and instead
- # explicitly tag your specs with their type, e.g.:
- #
- # RSpec.describe UsersController, :type => :controller do
- # # ...
- # end
- #
- # The different available types are documented in the features, such as in
- # https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!
# Filter lines from Rails gems in backtraces.