mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-21 15:54:22 +01:00
remove rails find_by_* helpers
This commit is contained in:
parent
cc06bcab85
commit
c13f640e81
@ -20,7 +20,7 @@ class API::CouponsController < API::ApiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def validate
|
def validate
|
||||||
@coupon = Coupon.find_by_code(params[:code])
|
@coupon = Coupon.find_by(code: params[:code])
|
||||||
if @coupon.nil?
|
if @coupon.nil?
|
||||||
render json: {status: 'rejected'}, status: :not_found
|
render json: {status: 'rejected'}, status: :not_found
|
||||||
else
|
else
|
||||||
@ -60,7 +60,7 @@ class API::CouponsController < API::ApiController
|
|||||||
def send_to
|
def send_to
|
||||||
authorize Coupon
|
authorize Coupon
|
||||||
|
|
||||||
@coupon = Coupon.find_by_code(params[:coupon_code])
|
@coupon = Coupon.find_by(code: params[:coupon_code])
|
||||||
if @coupon.nil?
|
if @coupon.nil?
|
||||||
render json: {error: "no coupon with code #{params[:coupon_code]}"}, status: :not_found
|
render json: {error: "no coupon with code #{params[:coupon_code]}"}, status: :not_found
|
||||||
else
|
else
|
||||||
|
@ -145,7 +145,7 @@ class API::MembersController < API::ApiController
|
|||||||
|
|
||||||
token = params.require(:user).permit(:auth_token)[:auth_token]
|
token = params.require(:user).permit(:auth_token)[:auth_token]
|
||||||
|
|
||||||
@account = User.find_by_auth_token(token)
|
@account = User.find_by(auth_token: token)
|
||||||
if @account
|
if @account
|
||||||
@flow_worker = MembersProcessor.new(@account)
|
@flow_worker = MembersProcessor.new(@account)
|
||||||
begin
|
begin
|
||||||
|
@ -41,7 +41,7 @@ class API::ProjectsController < API::ApiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def collaborator_valid
|
def collaborator_valid
|
||||||
project_user = ProjectUser.find_by_valid_token params[:valid_token]
|
project_user = ProjectUser.find_by(valid_token: params[:valid_token])
|
||||||
if project_user
|
if project_user
|
||||||
project_user.update(is_valid: true, valid_token: '')
|
project_user.update(is_valid: true, valid_token: '')
|
||||||
redirect_to "/#!/projects/#{project_user.project.id}" and return
|
redirect_to "/#!/projects/#{project_user.project.id}" and return
|
||||||
|
@ -22,7 +22,7 @@ class API::StatisticsController < API::ApiController
|
|||||||
|
|
||||||
# run additional custom aggregations, if any
|
# run additional custom aggregations, if any
|
||||||
if statistic_type and start_date and end_date
|
if statistic_type and start_date and end_date
|
||||||
stat_index = StatisticIndex.find_by_es_type_key("#{path}")
|
stat_index = StatisticIndex.find_by(es_type_key: "#{path}")
|
||||||
stat_type = StatisticType.where(statistic_index_id: stat_index.id, key: statistic_type).first
|
stat_type = StatisticType.where(statistic_index_id: stat_index.id, key: statistic_type).first
|
||||||
client = Elasticsearch::Model.client
|
client = Elasticsearch::Model.client
|
||||||
stat_type.statistic_custom_aggregations.each do |custom|
|
stat_type.statistic_custom_aggregations.each do |custom|
|
||||||
|
@ -134,7 +134,7 @@ class Reservation < ActiveRecord::Base
|
|||||||
|
|
||||||
# === Coupon ===
|
# === Coupon ===
|
||||||
unless coupon_code.nil?
|
unless coupon_code.nil?
|
||||||
cp = Coupon.find_by_code(coupon_code)
|
cp = Coupon.find_by(code: coupon_code)
|
||||||
if not cp.nil? and cp.status(user.id) == 'active'
|
if not cp.nil? and cp.status(user.id) == 'active'
|
||||||
@coupon = cp
|
@coupon = cp
|
||||||
total = invoice.invoice_items.map(&:amount).map(&:to_i).reduce(:+)
|
total = invoice.invoice_items.map(&:amount).map(&:to_i).reduce(:+)
|
||||||
@ -421,7 +421,7 @@ class Reservation < ActiveRecord::Base
|
|||||||
total = invoice.invoice_items.map(&:amount).map(&:to_i).reduce(:+)
|
total = invoice.invoice_items.map(&:amount).map(&:to_i).reduce(:+)
|
||||||
|
|
||||||
unless coupon_code.nil?
|
unless coupon_code.nil?
|
||||||
cp = Coupon.find_by_code(coupon_code)
|
cp = Coupon.find_by(code: coupon_code)
|
||||||
if not cp.nil? and cp.status(user.id) == 'active'
|
if not cp.nil? and cp.status(user.id) == 'active'
|
||||||
total = total - (total * cp.percent_off / 100.0)
|
total = total - (total * cp.percent_off / 100.0)
|
||||||
self.invoice.coupon_id = cp.id
|
self.invoice.coupon_id = cp.id
|
||||||
|
@ -25,7 +25,7 @@ class Subscription < ActiveRecord::Base
|
|||||||
invoice_items = []
|
invoice_items = []
|
||||||
|
|
||||||
unless coupon_code.nil?
|
unless coupon_code.nil?
|
||||||
cp = Coupon.find_by_code(coupon_code)
|
cp = Coupon.find_by(code: coupon_code)
|
||||||
if not cp.nil? and cp.status(user.id) == 'active'
|
if not cp.nil? and cp.status(user.id) == 'active'
|
||||||
@coupon = cp
|
@coupon = cp
|
||||||
total = plan.amount
|
total = plan.amount
|
||||||
@ -159,7 +159,7 @@ class Subscription < ActiveRecord::Base
|
|||||||
total = plan.amount
|
total = plan.amount
|
||||||
|
|
||||||
unless coupon_code.nil?
|
unless coupon_code.nil?
|
||||||
cp = Coupon.find_by_code(coupon_code)
|
cp = Coupon.find_by(code: coupon_code)
|
||||||
if not cp.nil? and cp.status(user.id) == 'active'
|
if not cp.nil? and cp.status(user.id) == 'active'
|
||||||
@coupon = cp
|
@coupon = cp
|
||||||
coupon_id = cp.id
|
coupon_id = cp.id
|
||||||
|
@ -131,7 +131,7 @@ class User < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
json.machine_credits machine_credits do |mc|
|
json.machine_credits machine_credits do |mc|
|
||||||
json.machine_id mc.creditable_id
|
json.machine_id mc.creditable_id
|
||||||
json.hours_used mc.users_credits.find_by_user_id(id).hours_used
|
json.hours_used mc.users_credits.find_by(user_id: id).hours_used
|
||||||
end
|
end
|
||||||
json.last_sign_in_at last_sign_in_at.iso8601 if last_sign_in_at
|
json.last_sign_in_at last_sign_in_at.iso8601 if last_sign_in_at
|
||||||
end
|
end
|
||||||
|
@ -54,7 +54,7 @@ json.array!(@members) do |member|
|
|||||||
|
|
||||||
json.machine_credits member.machine_credits do |mc|
|
json.machine_credits member.machine_credits do |mc|
|
||||||
json.machine_id mc.creditable_id
|
json.machine_id mc.creditable_id
|
||||||
json.hours_used mc.users_credits.find_by_user_id(member.id).hours_used
|
json.hours_used mc.users_credits.find_by(user_id: member.id).hours_used
|
||||||
end if attribute_requested?(@requested_attributes, 'credits') or attribute_requested?(@requested_attributes, 'machine_credits')
|
end if attribute_requested?(@requested_attributes, 'credits') or attribute_requested?(@requested_attributes, 'machine_credits')
|
||||||
|
|
||||||
json.tags member.tags do |t|
|
json.tags member.tags do |t|
|
||||||
|
@ -69,7 +69,7 @@ json.training_credits @member.training_credits do |tc|
|
|||||||
end
|
end
|
||||||
json.machine_credits @member.machine_credits do |mc|
|
json.machine_credits @member.machine_credits do |mc|
|
||||||
json.machine_id mc.creditable_id
|
json.machine_id mc.creditable_id
|
||||||
json.hours_used mc.users_credits.find_by_user_id(@member.id).hours_used
|
json.hours_used mc.users_credits.find_by(user_id: @member.id).hours_used
|
||||||
end
|
end
|
||||||
json.last_sign_in_at @member.last_sign_in_at.iso8601 if @member.last_sign_in_at
|
json.last_sign_in_at @member.last_sign_in_at.iso8601 if @member.last_sign_in_at
|
||||||
json.all_projects @member.all_projects do |project|
|
json.all_projects @member.all_projects do |project|
|
||||||
|
@ -10,7 +10,7 @@ json.user do
|
|||||||
end
|
end
|
||||||
json.machine_credits @reservation.user.machine_credits do |mc|
|
json.machine_credits @reservation.user.machine_credits do |mc|
|
||||||
json.machine_id mc.creditable_id
|
json.machine_id mc.creditable_id
|
||||||
json.hours_used mc.users_credits.find_by_user_id(@reservation.user_id).hours_used
|
json.hours_used mc.users_credits.find_by(user_id: @reservation.user_id).hours_used
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
json.message @reservation.message
|
json.message @reservation.message
|
||||||
|
@ -16,7 +16,7 @@ class ReservationReminderWorker
|
|||||||
already_sent = Notification.where(
|
already_sent = Notification.where(
|
||||||
attached_object_type: Reservation.name,
|
attached_object_type: Reservation.name,
|
||||||
attached_object_id: r.id,
|
attached_object_id: r.id,
|
||||||
notification_type_id: NotificationType.find_by_name('notify_member_reservation_reminder')
|
notification_type_id: NotificationType.find_by(name: 'notify_member_reservation_reminder')
|
||||||
).count
|
).count
|
||||||
unless already_sent > 0
|
unless already_sent > 0
|
||||||
NotificationCenter.call type: 'notify_member_reservation_reminder',
|
NotificationCenter.call type: 'notify_member_reservation_reminder',
|
||||||
|
@ -28,7 +28,7 @@ class MigrateEventReducedAmountToPriceCategory < ActiveRecord::Migration
|
|||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
pc = PriceCategory.find_by_name(I18n.t('price_category.reduced_fare'))
|
pc = PriceCategory.find_by(name: I18n.t('price_category.reduced_fare'))
|
||||||
EventPriceCategory.where(price_category_id: pc.id).each do |epc|
|
EventPriceCategory.where(price_category_id: pc.id).each do |epc|
|
||||||
epc.event.update_column(:reduced_amount, epc.amount)
|
epc.event.update_column(:reduced_amount, epc.amount)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
class InsertCustomAggregations < ActiveRecord::Migration
|
class InsertCustomAggregations < ActiveRecord::Migration
|
||||||
def up
|
def up
|
||||||
# available reservations hours for machines
|
# available reservations hours for machines
|
||||||
machine = StatisticIndex.find_by_es_type_key('machine')
|
machine = StatisticIndex.find_by(es_type_key: 'machine')
|
||||||
machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: machine.id)
|
machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: machine.id)
|
||||||
|
|
||||||
available_hours = StatisticCustomAggregation.new({
|
available_hours = StatisticCustomAggregation.new({
|
||||||
@ -14,7 +14,7 @@ class InsertCustomAggregations < ActiveRecord::Migration
|
|||||||
available_hours.save!
|
available_hours.save!
|
||||||
|
|
||||||
# available training tickets
|
# available training tickets
|
||||||
training = StatisticIndex.find_by_es_type_key('training')
|
training = StatisticIndex.find_by(es_type_key: 'training')
|
||||||
training_bookings = StatisticType.find_by(key: 'booking', statistic_index_id: training.id)
|
training_bookings = StatisticType.find_by(key: 'booking', statistic_index_id: training.id)
|
||||||
|
|
||||||
available_tickets = StatisticCustomAggregation.new({
|
available_tickets = StatisticCustomAggregation.new({
|
||||||
@ -29,12 +29,12 @@ class InsertCustomAggregations < ActiveRecord::Migration
|
|||||||
|
|
||||||
def down
|
def down
|
||||||
|
|
||||||
machine = StatisticIndex.find_by_es_type_key('machine')
|
machine = StatisticIndex.find_by(es_type_key: 'machine')
|
||||||
machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: machine.id)
|
machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: machine.id)
|
||||||
|
|
||||||
StatisticCustomAggregation.where(field: 'available_hours', statistic_type_id: machine_hours.id).first.destroy!
|
StatisticCustomAggregation.where(field: 'available_hours', statistic_type_id: machine_hours.id).first.destroy!
|
||||||
|
|
||||||
training = StatisticIndex.find_by_es_type_key('training')
|
training = StatisticIndex.find_by(es_type_key: 'training')
|
||||||
training_bookings = StatisticType.find_by(key: 'booking', statistic_index_id: training.id)
|
training_bookings = StatisticType.find_by(key: 'booking', statistic_index_id: training.id)
|
||||||
|
|
||||||
StatisticCustomAggregation.where(field: 'available_tickets', statistic_type_id: training_bookings.id).first.destroy!
|
StatisticCustomAggregation.where(field: 'available_tickets', statistic_type_id: training_bookings.id).first.destroy!
|
||||||
|
@ -2,7 +2,7 @@ namespace :fablab do
|
|||||||
# desc "Get all stripe plans and create in fablab app"
|
# desc "Get all stripe plans and create in fablab app"
|
||||||
# task stripe_plan: :environment do
|
# task stripe_plan: :environment do
|
||||||
# Stripe::Plan.all.data.each do |plan|
|
# Stripe::Plan.all.data.each do |plan|
|
||||||
# unless Plan.find_by_stp_plan_id(plan.id)
|
# unless Plan.find_by(stp_plan_id: plan.id)
|
||||||
# group = Group.friendly.find(plan.id.split('-').first)
|
# group = Group.friendly.find(plan.id.split('-').first)
|
||||||
# if group
|
# if group
|
||||||
# Plan.create(stp_plan_id: plan.id, name: plan.name, amount: plan.amount, interval: plan.interval, group_id: group.id, skip_create_stripe_plan: true)
|
# Plan.create(stp_plan_id: plan.id, name: plan.name, amount: plan.amount, interval: plan.interval, group_id: group.id, skip_create_stripe_plan: true)
|
||||||
|
@ -3,7 +3,7 @@ class AdminsTest < ActionDispatch::IntegrationTest
|
|||||||
# Called before every test method runs. Can be used
|
# Called before every test method runs. Can be used
|
||||||
# to set up fixture information.
|
# to set up fixture information.
|
||||||
def setup
|
def setup
|
||||||
@admin = User.find_by_username('admin')
|
@admin = User.find_by(username: 'admin')
|
||||||
login_as(@admin, scope: :user)
|
login_as(@admin, scope: :user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ module Availabilities
|
|||||||
end
|
end
|
||||||
|
|
||||||
test 'get machine availabilities as admin' do
|
test 'get machine availabilities as admin' do
|
||||||
m = Machine.find_by_slug('decoupeuse-vinyle')
|
m = Machine.find_by(slug: 'decoupeuse-vinyle')
|
||||||
|
|
||||||
get "/api/availabilities/machines/#{m.id}"
|
get "/api/availabilities/machines/#{m.id}"
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
class Availabilities::AsUserTest < ActionDispatch::IntegrationTest
|
class Availabilities::AsUserTest < ActionDispatch::IntegrationTest
|
||||||
setup do
|
setup do
|
||||||
user = User.find_by_username('kdumas')
|
user = User.find_by(username: 'kdumas')
|
||||||
login_as(user, scope: :user)
|
login_as(user, scope: :user)
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'get machine availabilities as user' do
|
test 'get machine availabilities as user' do
|
||||||
m = Machine.find_by_slug('decoupeuse-vinyle')
|
m = Machine.find_by(slug: 'decoupeuse-vinyle')
|
||||||
|
|
||||||
get "/api/availabilities/machines/#{m.id}"
|
get "/api/availabilities/machines/#{m.id}"
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class EventsTest < ActionDispatch::IntegrationTest
|
|||||||
post '/api/reservations',
|
post '/api/reservations',
|
||||||
{
|
{
|
||||||
reservation: {
|
reservation: {
|
||||||
user_id: User.find_by_username('pdurand').id,
|
user_id: User.find_by(username: 'pdurand').id,
|
||||||
reservable_id: e.id,
|
reservable_id: e.id,
|
||||||
reservable_type: 'Event',
|
reservable_type: 'Event',
|
||||||
nb_reserve_places: 2,
|
nb_reserve_places: 2,
|
||||||
@ -159,7 +159,7 @@ class EventsTest < ActionDispatch::IntegrationTest
|
|||||||
post '/api/reservations',
|
post '/api/reservations',
|
||||||
{
|
{
|
||||||
reservation: {
|
reservation: {
|
||||||
user_id: User.find_by_username('lseguin').id,
|
user_id: User.find_by(username: 'lseguin').id,
|
||||||
reservable_id: e.id,
|
reservable_id: e.id,
|
||||||
reservable_type: 'Event',
|
reservable_type: 'Event',
|
||||||
nb_reserve_places: 4,
|
nb_reserve_places: 4,
|
||||||
|
@ -3,12 +3,12 @@ module Subscriptions
|
|||||||
|
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@admin = User.find_by_username('admin')
|
@admin = User.find_by(username: 'admin')
|
||||||
login_as(@admin, scope: :user)
|
login_as(@admin, scope: :user)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "admin successfully takes a subscription for a user" do
|
test "admin successfully takes a subscription for a user" do
|
||||||
user = User.find_by_username('jdupond')
|
user = User.find_by(username: 'jdupond')
|
||||||
plan = Plan.find_by(group_id: user.group.id, type: 'Plan', base_name: 'Mensuel')
|
plan = Plan.find_by(group_id: user.group.id, type: 'Plan', base_name: 'Mensuel')
|
||||||
|
|
||||||
VCR.use_cassette("subscriptions_admin_create_success") do
|
VCR.use_cassette("subscriptions_admin_create_success") do
|
||||||
@ -40,7 +40,7 @@ module Subscriptions
|
|||||||
assert_equal user.subscription.plan.training_credit_nb, plan.training_credit_nb, 'trainings credits were not allocated'
|
assert_equal user.subscription.plan.training_credit_nb, plan.training_credit_nb, 'trainings credits were not allocated'
|
||||||
|
|
||||||
# Check that the user benefit from prices of his plan
|
# Check that the user benefit from prices of his plan
|
||||||
printer = Machine.find_by_slug('imprimante-3d')
|
printer = Machine.find_by(slug: 'imprimante-3d')
|
||||||
assert_equal 15, (printer.prices.find_by(group_id: user.group_id, plan_id: user.subscription.plan_id).amount / 100), 'machine hourly price does not match'
|
assert_equal 15, (printer.prices.find_by(group_id: user.group_id, plan_id: user.subscription.plan_id).amount / 100), 'machine hourly price does not match'
|
||||||
|
|
||||||
# Check notification was sent to the user
|
# Check notification was sent to the user
|
||||||
|
@ -2,7 +2,7 @@ class Subscriptions::CreateAsUserTest < ActionDispatch::IntegrationTest
|
|||||||
|
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@user = User.find_by_username('jdupond')
|
@user = User.find_by(username: 'jdupond')
|
||||||
login_as(@user, scope: :user)
|
login_as(@user, scope: :user)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ class Subscriptions::CreateAsUserTest < ActionDispatch::IntegrationTest
|
|||||||
assert_equal @user.subscription.plan.training_credit_nb, plan.training_credit_nb, 'trainings credits were not allocated'
|
assert_equal @user.subscription.plan.training_credit_nb, plan.training_credit_nb, 'trainings credits were not allocated'
|
||||||
|
|
||||||
# Check that the user benefit from prices of his plan
|
# Check that the user benefit from prices of his plan
|
||||||
printer = Machine.find_by_slug('imprimante-3d')
|
printer = Machine.find_by(slug: 'imprimante-3d')
|
||||||
assert_equal 15, (printer.prices.find_by(group_id: @user.group_id, plan_id: @user.subscription.plan_id).amount / 100), 'machine hourly price does not match'
|
assert_equal 15, (printer.prices.find_by(group_id: @user.group_id, plan_id: @user.subscription.plan_id).amount / 100), 'machine hourly price does not match'
|
||||||
|
|
||||||
# Check notifications were sent for every admins
|
# Check notifications were sent for every admins
|
||||||
@ -118,7 +118,7 @@ class Subscriptions::CreateAsUserTest < ActionDispatch::IntegrationTest
|
|||||||
assert_equal @vlonchamp.subscription.plan.training_credit_nb, plan.training_credit_nb, 'trainings credits were not allocated'
|
assert_equal @vlonchamp.subscription.plan.training_credit_nb, plan.training_credit_nb, 'trainings credits were not allocated'
|
||||||
|
|
||||||
# Check that the user benefit from prices of his plan
|
# Check that the user benefit from prices of his plan
|
||||||
printer = Machine.find_by_slug('imprimante-3d')
|
printer = Machine.find_by(slug: 'imprimante-3d')
|
||||||
assert_equal 10, (printer.prices.find_by(group_id: @vlonchamp.group_id, plan_id: @vlonchamp.subscription.plan_id).amount / 100), 'machine hourly price does not match'
|
assert_equal 10, (printer.prices.find_by(group_id: @vlonchamp.group_id, plan_id: @vlonchamp.subscription.plan_id).amount / 100), 'machine hourly price does not match'
|
||||||
|
|
||||||
# Check notifications were sent for every admins
|
# Check notifications were sent for every admins
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
class Subscriptions::RenewAsAdminTest < ActionDispatch::IntegrationTest
|
class Subscriptions::RenewAsAdminTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@admin = User.find_by_username('admin')
|
@admin = User.find_by(username: 'admin')
|
||||||
login_as(@admin, scope: :user)
|
login_as(@admin, scope: :user)
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'admin successfully renew a subscription before it has ended' do
|
test 'admin successfully renew a subscription before it has ended' do
|
||||||
|
|
||||||
user = User.find_by_username('kdumas')
|
user = User.find_by(username: 'kdumas')
|
||||||
plan = Plan.find_by(base_name: 'Mensuel tarif réduit')
|
plan = Plan.find_by(base_name: 'Mensuel tarif réduit')
|
||||||
|
|
||||||
VCR.use_cassette("subscriptions_admin_renew_success") do
|
VCR.use_cassette("subscriptions_admin_renew_success") do
|
||||||
@ -38,7 +38,7 @@ class Subscriptions::RenewAsAdminTest < ActionDispatch::IntegrationTest
|
|||||||
assert_equal user.subscription.plan.training_credit_nb, plan.training_credit_nb, 'trainings credits were not allocated'
|
assert_equal user.subscription.plan.training_credit_nb, plan.training_credit_nb, 'trainings credits were not allocated'
|
||||||
|
|
||||||
# Check that the user benefit from prices of his plan
|
# Check that the user benefit from prices of his plan
|
||||||
printer = Machine.find_by_slug('imprimante-3d')
|
printer = Machine.find_by(slug: 'imprimante-3d')
|
||||||
assert_equal 10, (printer.prices.find_by(group_id: user.group_id, plan_id: user.subscription.plan_id).amount / 100), 'machine hourly price does not match'
|
assert_equal 10, (printer.prices.find_by(group_id: user.group_id, plan_id: user.subscription.plan_id).amount / 100), 'machine hourly price does not match'
|
||||||
|
|
||||||
# Check notification was sent to the user
|
# Check notification was sent to the user
|
||||||
|
@ -2,7 +2,7 @@ class Subscriptions::RenewAsUserTest < ActionDispatch::IntegrationTest
|
|||||||
|
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@user = User.find_by_username('lseguin')
|
@user = User.find_by(username: 'lseguin')
|
||||||
login_as(@user, scope: :user)
|
login_as(@user, scope: :user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class WalletsTest < ActionDispatch::IntegrationTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
test 'admin can get wallet by user id' do
|
test 'admin can get wallet by user id' do
|
||||||
@admin = User.find_by_username('admin')
|
@admin = User.find_by(username: 'admin')
|
||||||
login_as(@admin, scope: :user)
|
login_as(@admin, scope: :user)
|
||||||
@user1 = User.first
|
@user1 = User.first
|
||||||
get "/api/wallet/by_user/#{@user1.id}"
|
get "/api/wallet/by_user/#{@user1.id}"
|
||||||
|
@ -7,7 +7,7 @@ class CouponTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
test 'expired coupon must return the proper status' do
|
test 'expired coupon must return the proper status' do
|
||||||
c = Coupon.find_by_code('XMAS10')
|
c = Coupon.find_by(code: 'XMAS10')
|
||||||
assert c.status == 'expired'
|
assert c.status == 'expired'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user