Merge branch 'dev_trustie' of https://git.trustie.net/qyzh1996/forgeplus into dev_trustie
This commit is contained in:
commit
5433920724
|
@ -0,0 +1,2 @@
|
||||||
|
// Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
// All this logic will automatically be available in application.js.
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
// All this logic will automatically be available in application.js.
|
|
@ -0,0 +1,84 @@
|
||||||
|
body {
|
||||||
|
background-color: #fff;
|
||||||
|
color: #333;
|
||||||
|
margin: 33px;
|
||||||
|
font-family: verdana, arial, helvetica, sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p, ol, ul, td {
|
||||||
|
font-family: verdana, arial, helvetica, sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
background-color: #eee;
|
||||||
|
padding: 10px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #000;
|
||||||
|
|
||||||
|
&:visited {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 0 5px 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div {
|
||||||
|
&.field, &.actions {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#notice {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field_with_errors {
|
||||||
|
padding: 2px;
|
||||||
|
background-color: red;
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
|
#error_explanation {
|
||||||
|
width: 450px;
|
||||||
|
border: 2px solid red;
|
||||||
|
padding: 7px 7px 0;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
text-align: left;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 5px 5px 5px 15px;
|
||||||
|
font-size: 12px;
|
||||||
|
margin: -7px -7px 0;
|
||||||
|
background-color: #c00;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul li {
|
||||||
|
font-size: 12px;
|
||||||
|
list-style: square;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
display: block;
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
// Place all the styles related to the SponsorTiers controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,3 @@
|
||||||
|
// Place all the styles related to the Sponsorships controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,74 @@
|
||||||
|
class SponsorTiersController < ApplicationController
|
||||||
|
before_action :set_sponsor_tier, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
|
# GET /sponsor_tiers
|
||||||
|
# GET /sponsor_tiers.json
|
||||||
|
def index
|
||||||
|
@sponsor_tiers = SponsorTier.all
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /sponsor_tiers/1
|
||||||
|
# GET /sponsor_tiers/1.json
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /sponsor_tiers/new
|
||||||
|
def new
|
||||||
|
@sponsor_tier = SponsorTier.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /sponsor_tiers/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /sponsor_tiers
|
||||||
|
# POST /sponsor_tiers.json
|
||||||
|
def create
|
||||||
|
@sponsor_tier = SponsorTier.new(sponsor_tier_params)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @sponsor_tier.save
|
||||||
|
format.html { redirect_to @sponsor_tier, notice: 'Sponsor tier was successfully created.' }
|
||||||
|
format.json { render :show, status: :created, location: @sponsor_tier }
|
||||||
|
else
|
||||||
|
format.html { render :new }
|
||||||
|
format.json { render json: @sponsor_tier.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /sponsor_tiers/1
|
||||||
|
# PATCH/PUT /sponsor_tiers/1.json
|
||||||
|
def update
|
||||||
|
respond_to do |format|
|
||||||
|
if @sponsor_tier.update(sponsor_tier_params)
|
||||||
|
format.html { redirect_to @sponsor_tier, notice: 'Sponsor tier was successfully updated.' }
|
||||||
|
format.json { render :show, status: :ok, location: @sponsor_tier }
|
||||||
|
else
|
||||||
|
format.html { render :edit }
|
||||||
|
format.json { render json: @sponsor_tier.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /sponsor_tiers/1
|
||||||
|
# DELETE /sponsor_tiers/1.json
|
||||||
|
def destroy
|
||||||
|
@sponsor_tier.destroy
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to sponsor_tiers_url, notice: 'Sponsor tier was successfully destroyed.' }
|
||||||
|
format.json { head :no_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_sponsor_tier
|
||||||
|
@sponsor_tier = SponsorTier.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# Only allow a list of trusted parameters through.
|
||||||
|
def sponsor_tier_params
|
||||||
|
params.require(:sponsor_tier).permit(:tier)
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,74 @@
|
||||||
|
class SponsorshipsController < ApplicationController
|
||||||
|
before_action :set_sponsorship, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
|
# GET /sponsorships
|
||||||
|
# GET /sponsorships.json
|
||||||
|
def index
|
||||||
|
@sponsorships = Sponsorship.all
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /sponsorships/1
|
||||||
|
# GET /sponsorships/1.json
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /sponsorships/new
|
||||||
|
def new
|
||||||
|
@sponsorship = Sponsorship.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /sponsorships/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /sponsorships
|
||||||
|
# POST /sponsorships.json
|
||||||
|
def create
|
||||||
|
@sponsorship = Sponsorship.new(sponsorship_params)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @sponsorship.save
|
||||||
|
format.html { redirect_to @sponsorship, notice: 'Sponsorship was successfully created.' }
|
||||||
|
format.json { render :show, status: :created, location: @sponsorship }
|
||||||
|
else
|
||||||
|
format.html { render :new }
|
||||||
|
format.json { render json: @sponsorship.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /sponsorships/1
|
||||||
|
# PATCH/PUT /sponsorships/1.json
|
||||||
|
def update
|
||||||
|
respond_to do |format|
|
||||||
|
if @sponsorship.update(sponsorship_params)
|
||||||
|
format.html { redirect_to @sponsorship, notice: 'Sponsorship was successfully updated.' }
|
||||||
|
format.json { render :show, status: :ok, location: @sponsorship }
|
||||||
|
else
|
||||||
|
format.html { render :edit }
|
||||||
|
format.json { render json: @sponsorship.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /sponsorships/1
|
||||||
|
# DELETE /sponsorships/1.json
|
||||||
|
def destroy
|
||||||
|
@sponsorship.destroy
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to sponsorships_url, notice: 'Sponsorship was successfully destroyed.' }
|
||||||
|
format.json { head :no_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_sponsorship
|
||||||
|
@sponsorship = Sponsorship.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# Only allow a list of trusted parameters through.
|
||||||
|
def sponsorship_params
|
||||||
|
params.require(:sponsorship).permit(:amount, :visible, :sponsor_id, :developer_id)
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module SponsorTiersHelper
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module SponsorshipsHelper
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class CoinChange < ApplicationRecord
|
||||||
|
belongs_to :to_wallet, class_name: 'Wallet'
|
||||||
|
belongs_to :from_wallet, class_name: 'Wallet'
|
||||||
|
validates :amount, presence: true
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
class PassedWaitlist < ApplicationRecord
|
||||||
|
belongs_to :applicant, class_name: 'User'
|
||||||
|
belongs_to :reviewer, class_name: 'User'
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
class SponsorTier < ApplicationRecord
|
||||||
|
belongs_to :user
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class Sponsorship < ApplicationRecord
|
||||||
|
belongs_to :sponsor, class_name: 'User'
|
||||||
|
belongs_to :developer, class_name: 'User'
|
||||||
|
validates :amount, presence: true
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class StoppedSponsorship < ApplicationRecord
|
||||||
|
belongs_to :sponsor, class_name: 'User'
|
||||||
|
belongs_to :developer, class_name: 'User'
|
||||||
|
validates :amount, presence: true
|
||||||
|
end
|
|
@ -92,6 +92,19 @@ class User < ApplicationRecord
|
||||||
# has_many :libraries, dependent: :destroy
|
# has_many :libraries, dependent: :destroy
|
||||||
has_many :project_trends, dependent: :destroy
|
has_many :project_trends, dependent: :destroy
|
||||||
|
|
||||||
|
# sponsor
|
||||||
|
has_many :as_sponsors, class_name: 'Sponsorship', foreign_key: 'sponsor_id', dependent: :destroy
|
||||||
|
has_many :as_sponsored, class_name: 'Sponsorship', foreign_key: 'developer_id', dependent: :destroy
|
||||||
|
has_many :stopped_sponsors, class_name: 'StoppedSponsorship', foreign_key: 'sponsor_id', dependent: :destroy
|
||||||
|
has_many :stopped_sponsored, class_name: 'StoppedSponsorship', foreign_key: 'developer_id', dependent: :destroy
|
||||||
|
has_many :sponsor_tier, dependent: :destroy
|
||||||
|
has_one :wallet, dependent: :destroy
|
||||||
|
has_many :waitlist, class_name: 'Waitlist', foreign_key: 'reviewer_id', optional: true
|
||||||
|
has_many :passed_waitlist, class_name: 'PassedWaitlist', foreign_key: 'reviewer_id', optional: true #as reviewer
|
||||||
|
has_one :application, class_name: 'Waitlist', foreign_key: 'applicant_id', optional: true
|
||||||
|
has_one :passed_application, class_name: 'PassedWaitlist', foreign_key: 'applicant_id', optional: true
|
||||||
|
|
||||||
|
|
||||||
# Groups and active users
|
# Groups and active users
|
||||||
scope :active, lambda { where(status: STATUS_ACTIVE) }
|
scope :active, lambda { where(status: STATUS_ACTIVE) }
|
||||||
scope :like, lambda { |keywords|
|
scope :like, lambda { |keywords|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
class Waitlist < ApplicationRecord
|
||||||
|
belongs_to :applicant, class_name: 'User'
|
||||||
|
belongs_to :reviewer, class_name: 'User', optional: true
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
class Wallet < ApplicationRecord
|
||||||
|
belongs_to :user
|
||||||
|
has_many :outcome, class_name: 'CoinChange', foreign_key: 'from_wallet_id', dependent: :destroy
|
||||||
|
has_many :income, class_name: 'CoinChange', foreign_key: 'to_wallet_id', dependent: :destroy
|
||||||
|
validates :balance, presence: true
|
||||||
|
end
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
<%= simple_form_for(@sponsor_tier) do |f| %>
|
||||||
|
<%= f.error_notification %>
|
||||||
|
<%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
|
||||||
|
|
||||||
|
<div class="form-inputs">
|
||||||
|
<%= f.input :tier %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<%= f.button :submit %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,2 @@
|
||||||
|
json.extract! sponsor_tier, :id, :tier, :created_at, :updated_at
|
||||||
|
json.url sponsor_tier_url(sponsor_tier, format: :json)
|
|
@ -0,0 +1,6 @@
|
||||||
|
<h1>Editing Sponsor Tier</h1>
|
||||||
|
|
||||||
|
<%= render 'form', sponsor_tier: @sponsor_tier %>
|
||||||
|
|
||||||
|
<%= link_to 'Show', @sponsor_tier %> |
|
||||||
|
<%= link_to 'Back', sponsor_tiers_path %>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
|
<h1>Sponsor Tiers</h1>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Tier</th>
|
||||||
|
<th colspan="3"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% @sponsor_tiers.each do |sponsor_tier| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= sponsor_tier.tier %></td>
|
||||||
|
<td><%= link_to 'Show', sponsor_tier %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_sponsor_tier_path(sponsor_tier) %></td>
|
||||||
|
<td><%= link_to 'Destroy', sponsor_tier, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<%= link_to 'New Sponsor Tier', new_sponsor_tier_path %>
|
|
@ -0,0 +1 @@
|
||||||
|
json.array! @sponsor_tiers, partial: "sponsor_tiers/sponsor_tier", as: :sponsor_tier
|
|
@ -0,0 +1,5 @@
|
||||||
|
<h1>New Sponsor Tier</h1>
|
||||||
|
|
||||||
|
<%= render 'form', sponsor_tier: @sponsor_tier %>
|
||||||
|
|
||||||
|
<%= link_to 'Back', sponsor_tiers_path %>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Tier:</strong>
|
||||||
|
<%= @sponsor_tier.tier %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<%= link_to 'Edit', edit_sponsor_tier_path(@sponsor_tier) %> |
|
||||||
|
<%= link_to 'Back', sponsor_tiers_path %>
|
|
@ -0,0 +1 @@
|
||||||
|
json.partial! "sponsor_tiers/sponsor_tier", sponsor_tier: @sponsor_tier
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
<%= simple_form_for(@sponsorship) do |f| %>
|
||||||
|
<%= f.error_notification %>
|
||||||
|
<%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
|
||||||
|
|
||||||
|
<div class="form-inputs">
|
||||||
|
<%= f.input :amount %>
|
||||||
|
<%= f.input :visible %>
|
||||||
|
<%= f.input :sponsor_id %>
|
||||||
|
<%= f.input :developer_id %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<%= f.button :submit %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,2 @@
|
||||||
|
json.extract! sponsorship, :id, :amount, :visible, :sponsor_id, :developer_id, :created_at, :updated_at
|
||||||
|
json.url sponsorship_url(sponsorship, format: :json)
|
|
@ -0,0 +1,6 @@
|
||||||
|
<h1>Editing Sponsorship</h1>
|
||||||
|
|
||||||
|
<%= render 'form', sponsorship: @sponsorship %>
|
||||||
|
|
||||||
|
<%= link_to 'Show', @sponsorship %> |
|
||||||
|
<%= link_to 'Back', sponsorships_path %>
|
|
@ -0,0 +1,33 @@
|
||||||
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
|
<h1>Sponsorships</h1>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Amount</th>
|
||||||
|
<th>Visible</th>
|
||||||
|
<th>Sponsor</th>
|
||||||
|
<th>Developer</th>
|
||||||
|
<th colspan="3"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% @sponsorships.each do |sponsorship| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= sponsorship.amount %></td>
|
||||||
|
<td><%= sponsorship.visible %></td>
|
||||||
|
<td><%= sponsorship.sponsor_id %></td>
|
||||||
|
<td><%= sponsorship.developer_id %></td>
|
||||||
|
<td><%= link_to 'Show', sponsorship %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_sponsorship_path(sponsorship) %></td>
|
||||||
|
<td><%= link_to 'Destroy', sponsorship, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<%= link_to 'New Sponsorship', new_sponsorship_path %>
|
|
@ -0,0 +1 @@
|
||||||
|
json.array! @sponsorships, partial: "sponsorships/sponsorship", as: :sponsorship
|
|
@ -0,0 +1,5 @@
|
||||||
|
<h1>New Sponsorship</h1>
|
||||||
|
|
||||||
|
<%= render 'form', sponsorship: @sponsorship %>
|
||||||
|
|
||||||
|
<%= link_to 'Back', sponsorships_path %>
|
|
@ -0,0 +1,24 @@
|
||||||
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Amount:</strong>
|
||||||
|
<%= @sponsorship.amount %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Visible:</strong>
|
||||||
|
<%= @sponsorship.visible %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Sponsor:</strong>
|
||||||
|
<%= @sponsorship.sponsor_id %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Developer:</strong>
|
||||||
|
<%= @sponsorship.developer_id %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<%= link_to 'Edit', edit_sponsorship_path(@sponsorship) %> |
|
||||||
|
<%= link_to 'Back', sponsorships_path %>
|
|
@ -0,0 +1 @@
|
||||||
|
json.partial! "sponsorships/sponsorship", sponsorship: @sponsorship
|
|
@ -1,5 +1,7 @@
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
resources :sponsor_tiers
|
||||||
|
resources :sponsorships
|
||||||
require 'sidekiq/web'
|
require 'sidekiq/web'
|
||||||
require 'admin_constraint'
|
require 'admin_constraint'
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
class AddColumnToTableUsers < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :users, :description, :string, default: ""
|
||||||
|
add_column :users, :sponsor_certification, :integer, default: 0
|
||||||
|
add_column :users, :sponsor_num, :integer, default: 0
|
||||||
|
add_column :users, :sponsored_num, :integer, default: 0
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
class CreateSponsorships < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :sponsorships do |t|
|
||||||
|
t.integer :amount
|
||||||
|
t.integer :visible
|
||||||
|
t.integer :sponsor_id
|
||||||
|
t.integer :developer_id
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,9 @@
|
||||||
|
class CreateSponsorTiers < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :sponsor_tiers do |t|
|
||||||
|
t.integer :tier
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
class AddColumnToSponsorTiers < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :sponsor_tiers, :description, :string, default: ""
|
||||||
|
add_column :sponsor_tiers, :user_id, :integer
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,11 @@
|
||||||
|
class CreateStoppedSponsorships < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :stopped_sponsorships do |t|
|
||||||
|
t.integer :amount
|
||||||
|
t.integer :sponsor_id
|
||||||
|
t.integer :developer_id
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,10 @@
|
||||||
|
class CreateWallets < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :wallets do |t|
|
||||||
|
t.integer :balance
|
||||||
|
t.integer :user_id
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,13 @@
|
||||||
|
class CreateCoinChanges < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :coin_changes do |t|
|
||||||
|
t.integer :amount
|
||||||
|
t.string :description
|
||||||
|
t.string :reason
|
||||||
|
t.integer :to_wallet_id
|
||||||
|
t.integer :from_wallet_id
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
class CreateWaitlists < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :waitlists do |t|
|
||||||
|
t.string :applicant_id
|
||||||
|
t.string :integer
|
||||||
|
t.string :reviewer_id
|
||||||
|
t.string :integer
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
class CreatePassedWaitlists < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :passed_waitlists do |t|
|
||||||
|
t.string :applicant_id
|
||||||
|
t.string :integer
|
||||||
|
t.string :reviewer_id
|
||||||
|
t.string :integer
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,141 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
||||||
|
# It demonstrates how one might use RSpec to specify the controller code that
|
||||||
|
# was generated by Rails when you ran the scaffold generator.
|
||||||
|
#
|
||||||
|
# It assumes that the implementation code is generated by the rails scaffold
|
||||||
|
# generator. If you are using any extension libraries to generate different
|
||||||
|
# controller code, this generated spec may or may not pass.
|
||||||
|
#
|
||||||
|
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
||||||
|
# of tools you can use to make these specs even more expressive, but we're
|
||||||
|
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
||||||
|
#
|
||||||
|
# Compared to earlier versions of this generator, there is very limited use of
|
||||||
|
# stubs and message expectations in this spec. Stubs are only used when there
|
||||||
|
# is no simpler way to get a handle on the object needed for the example.
|
||||||
|
# Message expectations are only used when there is no simpler way to specify
|
||||||
|
# that an instance is receiving a specific message.
|
||||||
|
#
|
||||||
|
# Also compared to earlier versions of this generator, there are no longer any
|
||||||
|
# expectations of assigns and templates rendered. These features have been
|
||||||
|
# removed from Rails core in Rails 5, but can be added back in via the
|
||||||
|
# `rails-controller-testing` gem.
|
||||||
|
|
||||||
|
RSpec.describe SponsorTiersController, type: :controller do
|
||||||
|
|
||||||
|
# This should return the minimal set of attributes required to create a valid
|
||||||
|
# SponsorTier. As you add validations to SponsorTier, be sure to
|
||||||
|
# adjust the attributes here as well.
|
||||||
|
let(:valid_attributes) {
|
||||||
|
skip("Add a hash of attributes valid for your model")
|
||||||
|
}
|
||||||
|
|
||||||
|
let(:invalid_attributes) {
|
||||||
|
skip("Add a hash of attributes invalid for your model")
|
||||||
|
}
|
||||||
|
|
||||||
|
# This should return the minimal set of values that should be in the session
|
||||||
|
# in order to pass any filters (e.g. authentication) defined in
|
||||||
|
# SponsorTiersController. Be sure to keep this updated too.
|
||||||
|
let(:valid_session) { {} }
|
||||||
|
|
||||||
|
describe "GET #index" do
|
||||||
|
it "returns a success response" do
|
||||||
|
SponsorTier.create! valid_attributes
|
||||||
|
get :index, params: {}, session: valid_session
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET #show" do
|
||||||
|
it "returns a success response" do
|
||||||
|
sponsor_tier = SponsorTier.create! valid_attributes
|
||||||
|
get :show, params: {id: sponsor_tier.to_param}, session: valid_session
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET #new" do
|
||||||
|
it "returns a success response" do
|
||||||
|
get :new, params: {}, session: valid_session
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET #edit" do
|
||||||
|
it "returns a success response" do
|
||||||
|
sponsor_tier = SponsorTier.create! valid_attributes
|
||||||
|
get :edit, params: {id: sponsor_tier.to_param}, session: valid_session
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "POST #create" do
|
||||||
|
context "with valid params" do
|
||||||
|
it "creates a new SponsorTier" do
|
||||||
|
expect {
|
||||||
|
post :create, params: {sponsor_tier: valid_attributes}, session: valid_session
|
||||||
|
}.to change(SponsorTier, :count).by(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "redirects to the created sponsor_tier" do
|
||||||
|
post :create, params: {sponsor_tier: valid_attributes}, session: valid_session
|
||||||
|
expect(response).to redirect_to(SponsorTier.last)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with invalid params" do
|
||||||
|
it "returns a success response (i.e. to display the 'new' template)" do
|
||||||
|
post :create, params: {sponsor_tier: invalid_attributes}, session: valid_session
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "PUT #update" do
|
||||||
|
context "with valid params" do
|
||||||
|
let(:new_attributes) {
|
||||||
|
skip("Add a hash of attributes valid for your model")
|
||||||
|
}
|
||||||
|
|
||||||
|
it "updates the requested sponsor_tier" do
|
||||||
|
sponsor_tier = SponsorTier.create! valid_attributes
|
||||||
|
put :update, params: {id: sponsor_tier.to_param, sponsor_tier: new_attributes}, session: valid_session
|
||||||
|
sponsor_tier.reload
|
||||||
|
skip("Add assertions for updated state")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "redirects to the sponsor_tier" do
|
||||||
|
sponsor_tier = SponsorTier.create! valid_attributes
|
||||||
|
put :update, params: {id: sponsor_tier.to_param, sponsor_tier: valid_attributes}, session: valid_session
|
||||||
|
expect(response).to redirect_to(sponsor_tier)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with invalid params" do
|
||||||
|
it "returns a success response (i.e. to display the 'edit' template)" do
|
||||||
|
sponsor_tier = SponsorTier.create! valid_attributes
|
||||||
|
put :update, params: {id: sponsor_tier.to_param, sponsor_tier: invalid_attributes}, session: valid_session
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "DELETE #destroy" do
|
||||||
|
it "destroys the requested sponsor_tier" do
|
||||||
|
sponsor_tier = SponsorTier.create! valid_attributes
|
||||||
|
expect {
|
||||||
|
delete :destroy, params: {id: sponsor_tier.to_param}, session: valid_session
|
||||||
|
}.to change(SponsorTier, :count).by(-1)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "redirects to the sponsor_tiers list" do
|
||||||
|
sponsor_tier = SponsorTier.create! valid_attributes
|
||||||
|
delete :destroy, params: {id: sponsor_tier.to_param}, session: valid_session
|
||||||
|
expect(response).to redirect_to(sponsor_tiers_url)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,141 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
||||||
|
# It demonstrates how one might use RSpec to specify the controller code that
|
||||||
|
# was generated by Rails when you ran the scaffold generator.
|
||||||
|
#
|
||||||
|
# It assumes that the implementation code is generated by the rails scaffold
|
||||||
|
# generator. If you are using any extension libraries to generate different
|
||||||
|
# controller code, this generated spec may or may not pass.
|
||||||
|
#
|
||||||
|
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
||||||
|
# of tools you can use to make these specs even more expressive, but we're
|
||||||
|
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
||||||
|
#
|
||||||
|
# Compared to earlier versions of this generator, there is very limited use of
|
||||||
|
# stubs and message expectations in this spec. Stubs are only used when there
|
||||||
|
# is no simpler way to get a handle on the object needed for the example.
|
||||||
|
# Message expectations are only used when there is no simpler way to specify
|
||||||
|
# that an instance is receiving a specific message.
|
||||||
|
#
|
||||||
|
# Also compared to earlier versions of this generator, there are no longer any
|
||||||
|
# expectations of assigns and templates rendered. These features have been
|
||||||
|
# removed from Rails core in Rails 5, but can be added back in via the
|
||||||
|
# `rails-controller-testing` gem.
|
||||||
|
|
||||||
|
RSpec.describe SponsorshipsController, type: :controller do
|
||||||
|
|
||||||
|
# This should return the minimal set of attributes required to create a valid
|
||||||
|
# Sponsorship. As you add validations to Sponsorship, be sure to
|
||||||
|
# adjust the attributes here as well.
|
||||||
|
let(:valid_attributes) {
|
||||||
|
skip("Add a hash of attributes valid for your model")
|
||||||
|
}
|
||||||
|
|
||||||
|
let(:invalid_attributes) {
|
||||||
|
skip("Add a hash of attributes invalid for your model")
|
||||||
|
}
|
||||||
|
|
||||||
|
# This should return the minimal set of values that should be in the session
|
||||||
|
# in order to pass any filters (e.g. authentication) defined in
|
||||||
|
# SponsorshipsController. Be sure to keep this updated too.
|
||||||
|
let(:valid_session) { {} }
|
||||||
|
|
||||||
|
describe "GET #index" do
|
||||||
|
it "returns a success response" do
|
||||||
|
Sponsorship.create! valid_attributes
|
||||||
|
get :index, params: {}, session: valid_session
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET #show" do
|
||||||
|
it "returns a success response" do
|
||||||
|
sponsorship = Sponsorship.create! valid_attributes
|
||||||
|
get :show, params: {id: sponsorship.to_param}, session: valid_session
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET #new" do
|
||||||
|
it "returns a success response" do
|
||||||
|
get :new, params: {}, session: valid_session
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET #edit" do
|
||||||
|
it "returns a success response" do
|
||||||
|
sponsorship = Sponsorship.create! valid_attributes
|
||||||
|
get :edit, params: {id: sponsorship.to_param}, session: valid_session
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "POST #create" do
|
||||||
|
context "with valid params" do
|
||||||
|
it "creates a new Sponsorship" do
|
||||||
|
expect {
|
||||||
|
post :create, params: {sponsorship: valid_attributes}, session: valid_session
|
||||||
|
}.to change(Sponsorship, :count).by(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "redirects to the created sponsorship" do
|
||||||
|
post :create, params: {sponsorship: valid_attributes}, session: valid_session
|
||||||
|
expect(response).to redirect_to(Sponsorship.last)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with invalid params" do
|
||||||
|
it "returns a success response (i.e. to display the 'new' template)" do
|
||||||
|
post :create, params: {sponsorship: invalid_attributes}, session: valid_session
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "PUT #update" do
|
||||||
|
context "with valid params" do
|
||||||
|
let(:new_attributes) {
|
||||||
|
skip("Add a hash of attributes valid for your model")
|
||||||
|
}
|
||||||
|
|
||||||
|
it "updates the requested sponsorship" do
|
||||||
|
sponsorship = Sponsorship.create! valid_attributes
|
||||||
|
put :update, params: {id: sponsorship.to_param, sponsorship: new_attributes}, session: valid_session
|
||||||
|
sponsorship.reload
|
||||||
|
skip("Add assertions for updated state")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "redirects to the sponsorship" do
|
||||||
|
sponsorship = Sponsorship.create! valid_attributes
|
||||||
|
put :update, params: {id: sponsorship.to_param, sponsorship: valid_attributes}, session: valid_session
|
||||||
|
expect(response).to redirect_to(sponsorship)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with invalid params" do
|
||||||
|
it "returns a success response (i.e. to display the 'edit' template)" do
|
||||||
|
sponsorship = Sponsorship.create! valid_attributes
|
||||||
|
put :update, params: {id: sponsorship.to_param, sponsorship: invalid_attributes}, session: valid_session
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "DELETE #destroy" do
|
||||||
|
it "destroys the requested sponsorship" do
|
||||||
|
sponsorship = Sponsorship.create! valid_attributes
|
||||||
|
expect {
|
||||||
|
delete :destroy, params: {id: sponsorship.to_param}, session: valid_session
|
||||||
|
}.to change(Sponsorship, :count).by(-1)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "redirects to the sponsorships list" do
|
||||||
|
sponsorship = Sponsorship.create! valid_attributes
|
||||||
|
delete :destroy, params: {id: sponsorship.to_param}, session: valid_session
|
||||||
|
expect(response).to redirect_to(sponsorships_url)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
# Specs in this file have access to a helper object that includes
|
||||||
|
# the SponsorTiersHelper. For example:
|
||||||
|
#
|
||||||
|
# describe SponsorTiersHelper do
|
||||||
|
# describe "string concat" do
|
||||||
|
# it "concats two strings with spaces" do
|
||||||
|
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
RSpec.describe SponsorTiersHelper, type: :helper do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
# Specs in this file have access to a helper object that includes
|
||||||
|
# the SponsorshipsHelper. For example:
|
||||||
|
#
|
||||||
|
# describe SponsorshipsHelper do
|
||||||
|
# describe "string concat" do
|
||||||
|
# it "concats two strings with spaces" do
|
||||||
|
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
RSpec.describe SponsorshipsHelper, type: :helper do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe CoinChange, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe PassedWaitlist, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe SponsorTier, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Sponsorship, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe StoppedSponsorship, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Waitlist, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Wallet, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,10 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "SponsorTiers", type: :request do
|
||||||
|
describe "GET /sponsor_tiers" do
|
||||||
|
it "works! (now write some real specs)" do
|
||||||
|
get sponsor_tiers_path
|
||||||
|
expect(response).to have_http_status(200)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,10 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "Sponsorships", type: :request do
|
||||||
|
describe "GET /sponsorships" do
|
||||||
|
it "works! (now write some real specs)" do
|
||||||
|
get sponsorships_path
|
||||||
|
expect(response).to have_http_status(200)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,38 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
RSpec.describe SponsorTiersController, type: :routing do
|
||||||
|
describe "routing" do
|
||||||
|
it "routes to #index" do
|
||||||
|
expect(:get => "/sponsor_tiers").to route_to("sponsor_tiers#index")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #new" do
|
||||||
|
expect(:get => "/sponsor_tiers/new").to route_to("sponsor_tiers#new")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #show" do
|
||||||
|
expect(:get => "/sponsor_tiers/1").to route_to("sponsor_tiers#show", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #edit" do
|
||||||
|
expect(:get => "/sponsor_tiers/1/edit").to route_to("sponsor_tiers#edit", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
it "routes to #create" do
|
||||||
|
expect(:post => "/sponsor_tiers").to route_to("sponsor_tiers#create")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #update via PUT" do
|
||||||
|
expect(:put => "/sponsor_tiers/1").to route_to("sponsor_tiers#update", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #update via PATCH" do
|
||||||
|
expect(:patch => "/sponsor_tiers/1").to route_to("sponsor_tiers#update", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #destroy" do
|
||||||
|
expect(:delete => "/sponsor_tiers/1").to route_to("sponsor_tiers#destroy", :id => "1")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,38 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
RSpec.describe SponsorshipsController, type: :routing do
|
||||||
|
describe "routing" do
|
||||||
|
it "routes to #index" do
|
||||||
|
expect(:get => "/sponsorships").to route_to("sponsorships#index")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #new" do
|
||||||
|
expect(:get => "/sponsorships/new").to route_to("sponsorships#new")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #show" do
|
||||||
|
expect(:get => "/sponsorships/1").to route_to("sponsorships#show", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #edit" do
|
||||||
|
expect(:get => "/sponsorships/1/edit").to route_to("sponsorships#edit", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
it "routes to #create" do
|
||||||
|
expect(:post => "/sponsorships").to route_to("sponsorships#create")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #update via PUT" do
|
||||||
|
expect(:put => "/sponsorships/1").to route_to("sponsorships#update", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #update via PATCH" do
|
||||||
|
expect(:patch => "/sponsorships/1").to route_to("sponsorships#update", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #destroy" do
|
||||||
|
expect(:delete => "/sponsorships/1").to route_to("sponsorships#destroy", :id => "1")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,18 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "sponsor_tiers/edit", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
@sponsor_tier = assign(:sponsor_tier, SponsorTier.create!(
|
||||||
|
:tier => 1
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders the edit sponsor_tier form" do
|
||||||
|
render
|
||||||
|
|
||||||
|
assert_select "form[action=?][method=?]", sponsor_tier_path(@sponsor_tier), "post" do
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "sponsor_tier[tier]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,19 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "sponsor_tiers/index", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
assign(:sponsor_tiers, [
|
||||||
|
SponsorTier.create!(
|
||||||
|
:tier => 2
|
||||||
|
),
|
||||||
|
SponsorTier.create!(
|
||||||
|
:tier => 2
|
||||||
|
)
|
||||||
|
])
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders a list of sponsor_tiers" do
|
||||||
|
render
|
||||||
|
assert_select "tr>td", :text => 2.to_s, :count => 2
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,18 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "sponsor_tiers/new", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
assign(:sponsor_tier, SponsorTier.new(
|
||||||
|
:tier => 1
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders new sponsor_tier form" do
|
||||||
|
render
|
||||||
|
|
||||||
|
assert_select "form[action=?][method=?]", sponsor_tiers_path, "post" do
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "sponsor_tier[tier]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,14 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "sponsor_tiers/show", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
@sponsor_tier = assign(:sponsor_tier, SponsorTier.create!(
|
||||||
|
:tier => 2
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders attributes in <p>" do
|
||||||
|
render
|
||||||
|
expect(rendered).to match(/2/)
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,27 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "sponsorships/edit", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
@sponsorship = assign(:sponsorship, Sponsorship.create!(
|
||||||
|
:amount => 1,
|
||||||
|
:visible => 1,
|
||||||
|
:sponsor_id => 1,
|
||||||
|
:developer_id => 1
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders the edit sponsorship form" do
|
||||||
|
render
|
||||||
|
|
||||||
|
assert_select "form[action=?][method=?]", sponsorship_path(@sponsorship), "post" do
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "sponsorship[amount]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "sponsorship[visible]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "sponsorship[sponsor_id]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "sponsorship[developer_id]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,28 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "sponsorships/index", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
assign(:sponsorships, [
|
||||||
|
Sponsorship.create!(
|
||||||
|
:amount => 2,
|
||||||
|
:visible => 3,
|
||||||
|
:sponsor_id => 4,
|
||||||
|
:developer_id => 5
|
||||||
|
),
|
||||||
|
Sponsorship.create!(
|
||||||
|
:amount => 2,
|
||||||
|
:visible => 3,
|
||||||
|
:sponsor_id => 4,
|
||||||
|
:developer_id => 5
|
||||||
|
)
|
||||||
|
])
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders a list of sponsorships" do
|
||||||
|
render
|
||||||
|
assert_select "tr>td", :text => 2.to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => 3.to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => 4.to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => 5.to_s, :count => 2
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,27 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "sponsorships/new", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
assign(:sponsorship, Sponsorship.new(
|
||||||
|
:amount => 1,
|
||||||
|
:visible => 1,
|
||||||
|
:sponsor_id => 1,
|
||||||
|
:developer_id => 1
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders new sponsorship form" do
|
||||||
|
render
|
||||||
|
|
||||||
|
assert_select "form[action=?][method=?]", sponsorships_path, "post" do
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "sponsorship[amount]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "sponsorship[visible]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "sponsorship[sponsor_id]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "sponsorship[developer_id]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,20 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "sponsorships/show", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
@sponsorship = assign(:sponsorship, Sponsorship.create!(
|
||||||
|
:amount => 2,
|
||||||
|
:visible => 3,
|
||||||
|
:sponsor_id => 4,
|
||||||
|
:developer_id => 5
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders attributes in <p>" do
|
||||||
|
render
|
||||||
|
expect(rendered).to match(/2/)
|
||||||
|
expect(rendered).to match(/3/)
|
||||||
|
expect(rendered).to match(/4/)
|
||||||
|
expect(rendered).to match(/5/)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue