mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
removing spec folder
This commit is contained in:
parent
2166157724
commit
7dd7fb13f6
@ -1,10 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
factory :abus, :class => 'Abuse' do
|
|
||||||
signaled nil
|
|
||||||
first_name "MyString"
|
|
||||||
last_name "MyString"
|
|
||||||
email ""
|
|
||||||
message "MyText"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,8 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
factory :auth_provider do
|
|
||||||
name "MyString"
|
|
||||||
type ""
|
|
||||||
status "MyString"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
#FactoryGirl.define do
|
|
||||||
#factory :availability do
|
|
||||||
|
|
||||||
#end
|
|
||||||
|
|
||||||
#end
|
|
@ -1,7 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
factory :availability_tag do
|
|
||||||
availability nil
|
|
||||||
tag nil
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
#FactoryGirl.define do
|
|
||||||
#factory :avoir do
|
|
||||||
|
|
||||||
#end
|
|
||||||
|
|
||||||
#end
|
|
@ -1,6 +0,0 @@
|
|||||||
#FactoryGirl.define do
|
|
||||||
#factory :credit do
|
|
||||||
|
|
||||||
#end
|
|
||||||
|
|
||||||
#end
|
|
@ -1,6 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
factory :custom_asset do
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
factory :database_provider do
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
#FactoryGirl.define do
|
|
||||||
#factory :invoice do
|
|
||||||
|
|
||||||
#end
|
|
||||||
|
|
||||||
#end
|
|
@ -1,6 +0,0 @@
|
|||||||
#FactoryGirl.define do
|
|
||||||
#factory :machine do
|
|
||||||
|
|
||||||
#end
|
|
||||||
|
|
||||||
#end
|
|
@ -1,10 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
factory :o_auth2_mapping do
|
|
||||||
o_auth2_provider nil
|
|
||||||
resource_url "MyString"
|
|
||||||
local_field "MyString"
|
|
||||||
api_field "MyString"
|
|
||||||
data_type "MyString"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,11 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
factory :o_auth2_provider do
|
|
||||||
base_url "MyString"
|
|
||||||
token_endpoint "MyString"
|
|
||||||
authorization_endpoint "MyString"
|
|
||||||
client_id "MyString"
|
|
||||||
client_secret "MyString"
|
|
||||||
auth_provider nil
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
#FactoryGirl.define do
|
|
||||||
#factory :plan do
|
|
||||||
|
|
||||||
#end
|
|
||||||
|
|
||||||
#end
|
|
@ -1,9 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
factory :price do
|
|
||||||
group nil
|
|
||||||
plan nil
|
|
||||||
priceable nil
|
|
||||||
amount 1
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,11 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
sequence(:last_name) { |n| n }
|
|
||||||
|
|
||||||
factory :profile do
|
|
||||||
first_name 'member'
|
|
||||||
last_name { FactoryGirl.generate :last_name }
|
|
||||||
gender true
|
|
||||||
birthday { 30.years.ago }
|
|
||||||
phone '0606060606'
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,8 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
sequence(:name) { |n| "project#{n}" }
|
|
||||||
|
|
||||||
factory :project do
|
|
||||||
name { FactoryGirl.generate :name }
|
|
||||||
description { Faker::Lorem.paragraph }
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
#FactoryGirl.define do
|
|
||||||
#factory :reservation do
|
|
||||||
|
|
||||||
#end
|
|
||||||
|
|
||||||
#end
|
|
@ -1,6 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
factory :stylesheet do
|
|
||||||
contents "MyString"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
#FactoryGirl.define do
|
|
||||||
#factory :subscription do
|
|
||||||
|
|
||||||
#end
|
|
||||||
|
|
||||||
#end
|
|
@ -1,6 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
factory :tag do
|
|
||||||
name "MyString"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
#FactoryGirl.define do
|
|
||||||
#factory :training do
|
|
||||||
|
|
||||||
#end
|
|
||||||
|
|
||||||
#end
|
|
@ -1,7 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
factory :user_tag do
|
|
||||||
user nil
|
|
||||||
tag nil
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,14 +0,0 @@
|
|||||||
FactoryGirl.define do
|
|
||||||
sequence(:email) { |n| "member#{n}@sleede.com" }
|
|
||||||
sequence(:username) { |n| "member#{n}" }
|
|
||||||
|
|
||||||
factory :user do
|
|
||||||
email { FactoryGirl.generate :email }
|
|
||||||
username { FactoryGirl.generate :username }
|
|
||||||
password 'sleede22'
|
|
||||||
password_confirmation 'sleede22'
|
|
||||||
association :profile, strategy: :build
|
|
||||||
group { Group.first }
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,9 +0,0 @@
|
|||||||
class DeviseMailerPreview < ActionMailer::Preview
|
|
||||||
def confirmation_instructions
|
|
||||||
Devise::Mailer.confirmation_instructions(User.last, SecureRandom.hex)
|
|
||||||
end
|
|
||||||
|
|
||||||
def reset_password_instructions
|
|
||||||
Devise::Mailer.reset_password_instructions(User.last, SecureRandom.hex)
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,7 +0,0 @@
|
|||||||
class NotificationsMailerPreview < ActionMailer::Preview
|
|
||||||
NotificationType::NAMES.each do |name|
|
|
||||||
define_method name do
|
|
||||||
NotificationsMailer.send_mail_by(Notification.where(notification_type_id: NotificationType.find_by_name(name)).last)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
class UsersMailerPreview < ActionMailer::Preview
|
|
||||||
def notify_user_account_created
|
|
||||||
UsersMailer.notify_user_account_created(User.first, 'wfwwefwefsdfsdf')
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Abuse, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe AuthProvider, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,24 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Availability, type: :model do
|
|
||||||
|
|
||||||
describe 'create' do
|
|
||||||
it 'is success with start at, end at and type'
|
|
||||||
it 'is invalid without start at'
|
|
||||||
it 'is invalid without end at'
|
|
||||||
it 'is invalid without type'
|
|
||||||
it 'is invalid type isnt in [training, machines, event]'
|
|
||||||
it 'is invalid without training_ids when type training'
|
|
||||||
it 'is invalid without machine_ids when type machines'
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should can associate one or many reservations'
|
|
||||||
|
|
||||||
it 'should can destroy if dont any reservations'
|
|
||||||
|
|
||||||
it 'should get a title'
|
|
||||||
|
|
||||||
it 'should set a number of places'
|
|
||||||
|
|
||||||
it 'should be completed when number of reservations equal number of places'
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe AvailabilityTag, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,9 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Avoir, type: :model do
|
|
||||||
it 'should generate a reference after create'
|
|
||||||
|
|
||||||
it 'is invoiced if avoir mode isnt in [stripe, cheque, transfer, none, cash]'
|
|
||||||
|
|
||||||
it 'should can expire user subscription if avoir indicate subscription to expire'
|
|
||||||
end
|
|
@ -1,11 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Credit, type: :model do
|
|
||||||
context 'training' do
|
|
||||||
it 'should is saved with plan'
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'machine' do
|
|
||||||
it 'should is saved with plan and hours'
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe CustomAsset, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe DatabaseProvider, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,9 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Invoice, type: :model do
|
|
||||||
it 'should generate a reference after create'
|
|
||||||
|
|
||||||
it 'should generate a invoice pdf'
|
|
||||||
|
|
||||||
it 'should can build a avoir'
|
|
||||||
end
|
|
@ -1,21 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Machine, type: :model do
|
|
||||||
|
|
||||||
describe 'create' do
|
|
||||||
it 'is success with name, image, description and spec'
|
|
||||||
it 'is invalid without name'
|
|
||||||
it 'is invalid without image'
|
|
||||||
it 'is invalid without description'
|
|
||||||
it 'is invalid without spec'
|
|
||||||
it 'should auto generate slug by name'
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'can have many machine files'
|
|
||||||
|
|
||||||
it 'can have many projects'
|
|
||||||
|
|
||||||
it 'can have many trainings'
|
|
||||||
|
|
||||||
it 'should return an amount by user group'
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe OAuth2Mapping, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe OAuth2Provider, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,60 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Plan, type: :model do
|
|
||||||
let(:group){ Group.new(name: 'groupe test', slug: SecureRandom.hex) }
|
|
||||||
|
|
||||||
describe 'validations' do
|
|
||||||
it 'is success with amount and group' do
|
|
||||||
plan = Plan.new(amount: 500, group: group)
|
|
||||||
expect(plan).to be_valid
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is invalid without amount' do
|
|
||||||
plan = Plan.new(group: group)
|
|
||||||
expect(plan).to be_invalid
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is invalid without group' do
|
|
||||||
plan = Plan.new(amount: 500)
|
|
||||||
expect(plan).to be_invalid
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "on creation" do
|
|
||||||
before :each do
|
|
||||||
@plan_id = SecureRandom.hex
|
|
||||||
@plan_name = SecureRandom.hex
|
|
||||||
allow(Stripe::Plan).to receive(:create).and_return(double(id: @plan_id, name: @plan_name))
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'calls Stripe::Plan create method' do
|
|
||||||
plan = Plan.create(amount: 500, interval: 'month', group: group)
|
|
||||||
expect(Stripe::Plan).to have_received :create
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'saves stripe_plan.id' do
|
|
||||||
plan = Plan.create(amount: 500, interval: 'month', group: group)
|
|
||||||
expect(plan.stp_plan_id).to eq(@plan_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'saves stripe_plan.name' do
|
|
||||||
plan = Plan.create(amount: 500, interval: 'month', group: group)
|
|
||||||
expect(plan.name).to eq(@plan_name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "on update" do
|
|
||||||
before :each do
|
|
||||||
allow(Stripe::Plan).to receive(:create).and_return(double(id: SecureRandom.hex, name: SecureRandom.hex))
|
|
||||||
end
|
|
||||||
|
|
||||||
let(:plan){ Plan.create(amount: 500, interval: 'month', group: group) }
|
|
||||||
|
|
||||||
describe "update_stripe_plan" do
|
|
||||||
it "should return false if plan already has subscriptions" do
|
|
||||||
allow(plan).to receive(:subscriptions).and_return([1,2])
|
|
||||||
expect(plan.send(:update_stripe_plan)).to eq(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Price, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,30 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Project, type: :model do
|
|
||||||
|
|
||||||
describe 'create' do
|
|
||||||
it 'is success with author, name and description'
|
|
||||||
it 'is invalid without author'
|
|
||||||
it 'is invalid without name'
|
|
||||||
it 'is invalid without description'
|
|
||||||
it 'should auto generate slug by name'
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'save as draft by default'
|
|
||||||
|
|
||||||
it 'should can published'
|
|
||||||
|
|
||||||
it 'should have a published time after published'
|
|
||||||
|
|
||||||
it 'can only add one project main image'
|
|
||||||
|
|
||||||
it 'can have many project caos'
|
|
||||||
|
|
||||||
it 'can have many machines'
|
|
||||||
|
|
||||||
it 'can have many components'
|
|
||||||
|
|
||||||
it 'can have many project steps'
|
|
||||||
|
|
||||||
it 'can add a licence'
|
|
||||||
end
|
|
@ -1,28 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Reservation, type: :model do
|
|
||||||
describe 'create' do
|
|
||||||
it 'is success with user, slots and reservable'
|
|
||||||
it 'is invalid if reservable isnt in [Training, Machine, Event]'
|
|
||||||
|
|
||||||
it 'is success with a subscription'
|
|
||||||
|
|
||||||
context 'stripe' do
|
|
||||||
it 'should payment success'
|
|
||||||
it 'is invalid if payment info invalid'
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'satori' do
|
|
||||||
it 'should success'
|
|
||||||
it 'is invalid if payment info invalid'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should update user credit after creation'
|
|
||||||
|
|
||||||
it 'should create a invoice'
|
|
||||||
|
|
||||||
it 'should can set a nb reserve places'
|
|
||||||
|
|
||||||
it 'should can set a nb reserve reduced places'
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Stylesheet, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,26 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Subscription, type: :model do
|
|
||||||
describe 'create' do
|
|
||||||
it 'is success with user, plan'
|
|
||||||
|
|
||||||
it 'is success with a subscription'
|
|
||||||
|
|
||||||
context 'stripe' do
|
|
||||||
it 'should payment success'
|
|
||||||
it 'is invalid if payment info invalid'
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'satori' do
|
|
||||||
it 'should success'
|
|
||||||
it 'is invalid if payment info invalid'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should reset user credit after creation'
|
|
||||||
|
|
||||||
it 'should set a expired at after creation'
|
|
||||||
|
|
||||||
it 'should create a invoice'
|
|
||||||
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Tag, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,18 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Training, type: :model do
|
|
||||||
|
|
||||||
describe 'create' do
|
|
||||||
it 'is success with name'
|
|
||||||
it 'is invalid without name'
|
|
||||||
it 'should auto generate slug by name'
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'can associate many machines'
|
|
||||||
|
|
||||||
it 'can return a user list that valided by traning'
|
|
||||||
|
|
||||||
it 'should return an amount by user group'
|
|
||||||
|
|
||||||
it 'should can add a number place'
|
|
||||||
end
|
|
@ -1,74 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe User, type: :model do
|
|
||||||
let!(:user) { build :user }
|
|
||||||
|
|
||||||
describe 'create' do
|
|
||||||
it 'is success if user email, gender, first name, last name, group, birthday and phone are presents' do
|
|
||||||
expect(user.save).to be true
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is invalid when email is empty' do
|
|
||||||
user.email = nil
|
|
||||||
expect(user).to be_invalid
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is invalid when email format invalid' do
|
|
||||||
user.email = 'this a invalid email'
|
|
||||||
expect(user).to be_invalid
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is invalid when first name is empty' do
|
|
||||||
user.profile.first_name = nil
|
|
||||||
expect(user).to be_invalid
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is invalid when last name is empty' do
|
|
||||||
user.profile.last_name = nil
|
|
||||||
expect(user).to be_invalid
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is invalid when birthday is empty' do
|
|
||||||
user.profile.birthday = nil
|
|
||||||
expect(user).to be_invalid
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is invalid when phone is empty or not numerical' do
|
|
||||||
user.profile.phone = nil
|
|
||||||
expect(user).to be_invalid
|
|
||||||
user.profile.phone = "phone"
|
|
||||||
expect(user).to be_invalid
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is invalid when group is empty' do
|
|
||||||
user.group = nil
|
|
||||||
expect(user).to be_invalid
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is invalid when group is empty' do
|
|
||||||
user.group = nil
|
|
||||||
expect(user).to be_invalid
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is invalid when dont accept cgu' do
|
|
||||||
user.cgu = '0'
|
|
||||||
expect(user).to be_invalid
|
|
||||||
expect(user.errors[:cgu]).to include(I18n.t('activerecord.errors.messages.empty'))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'after creation' do
|
|
||||||
it 'has a member role' do
|
|
||||||
member = create(:user)
|
|
||||||
expect(member.is_member?).to be true
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'create a stripe customer' do
|
|
||||||
member = create(:user)
|
|
||||||
allow(member).to receive(:create_stripe_customer) { |u| member.stp_customer_id = 'stripe customer id' }
|
|
||||||
member.run_callbacks(:commit)
|
|
||||||
expect(member.stp_customer_id).to eq 'stripe customer id'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe UserTag, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,50 +0,0 @@
|
|||||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
||||||
ENV['RAILS_ENV'] ||= 'test'
|
|
||||||
require 'spec_helper'
|
|
||||||
require File.expand_path('../../config/environment', __FILE__)
|
|
||||||
require 'rspec/rails'
|
|
||||||
# Add additional requires below this line. Rails is not loaded until this point!
|
|
||||||
|
|
||||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
|
||||||
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
|
||||||
# run as spec files by default. This means that files in spec/support that end
|
|
||||||
# in _spec.rb will both be required and run as specs, causing the specs to be
|
|
||||||
# run twice. It is recommended that you do not name files matching this glob to
|
|
||||||
# end with _spec.rb. You can configure this pattern with the --pattern
|
|
||||||
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
|
||||||
#
|
|
||||||
# The following line is provided for convenience purposes. It has the downside
|
|
||||||
# of increasing the boot-up time by auto-requiring all files in the support
|
|
||||||
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
|
||||||
# require only the support files necessary.
|
|
||||||
#
|
|
||||||
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
|
||||||
|
|
||||||
# Checks for pending migrations before tests are run.
|
|
||||||
# If you are not using ActiveRecord, you can remove this line.
|
|
||||||
ActiveRecord::Migration.maintain_test_schema!
|
|
||||||
|
|
||||||
RSpec.configure do |config|
|
|
||||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
||||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
||||||
|
|
||||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
||||||
# examples within a transaction, remove the following line or assign false
|
|
||||||
# instead of true.
|
|
||||||
config.use_transactional_fixtures = true
|
|
||||||
|
|
||||||
# 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!
|
|
||||||
end
|
|
@ -1,31 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe NotificationCenter do
|
|
||||||
let(:receiver1) { create :user }
|
|
||||||
let(:receiver2) { create :user }
|
|
||||||
let(:project) { create :project }
|
|
||||||
|
|
||||||
it 'should respond to method .call' do
|
|
||||||
expect(NotificationCenter).to respond_to(:call)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should create a notification' do
|
|
||||||
options = {
|
|
||||||
type: 'notify_admin_when_project_published',
|
|
||||||
receiver: receiver1,
|
|
||||||
attached_object: project
|
|
||||||
}
|
|
||||||
NotificationCenter.call(options)
|
|
||||||
expect(Notification.count).to eq 1
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should create same number of notifications with number of receiver' do
|
|
||||||
options = {
|
|
||||||
type: 'notify_admin_when_project_published',
|
|
||||||
receiver: [receiver1, receiver2],
|
|
||||||
attached_object: project
|
|
||||||
}
|
|
||||||
NotificationCenter.call(options)
|
|
||||||
expect(Notification.count).to eq 2
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,87 +0,0 @@
|
|||||||
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
|
||||||
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
||||||
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
||||||
# this file to always be loaded, without a need to explicitly require it in any
|
|
||||||
# files.
|
|
||||||
#
|
|
||||||
# Given that it is always loaded, you are encouraged to keep this file as
|
|
||||||
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
||||||
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
||||||
# individual file that may not need all of that loaded. Instead, consider making
|
|
||||||
# a separate helper file that requires the additional dependencies and performs
|
|
||||||
# the additional setup, and require it from the spec files that actually need
|
|
||||||
# it.
|
|
||||||
#
|
|
||||||
# The `.rspec` file also contains a few flags that are not defaults but that
|
|
||||||
# users commonly want.
|
|
||||||
#
|
|
||||||
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
||||||
RSpec.configure do |config|
|
|
||||||
# rspec-expectations config goes here. You can use an alternate
|
|
||||||
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
||||||
# assertions if you prefer.
|
|
||||||
config.expect_with :rspec do |expectations|
|
|
||||||
# This option will default to `true` in RSpec 4. It makes the `description`
|
|
||||||
# and `failure_message` of custom matchers include text for helper methods
|
|
||||||
# defined using `chain`, e.g.:
|
|
||||||
# be_bigger_than(2).and_smaller_than(4).description
|
|
||||||
# # => "be bigger than 2 and smaller than 4"
|
|
||||||
# ...rather than:
|
|
||||||
# # => "be bigger than 2"
|
|
||||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
||||||
end
|
|
||||||
|
|
||||||
# rspec-mocks config goes here. You can use an alternate test double
|
|
||||||
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
||||||
config.mock_with :rspec do |mocks|
|
|
||||||
# Prevents you from mocking or stubbing a method that does not exist on
|
|
||||||
# a real object. This is generally recommended, and will default to
|
|
||||||
# `true` in RSpec 4.
|
|
||||||
mocks.verify_partial_doubles = true
|
|
||||||
end
|
|
||||||
|
|
||||||
# The settings below are suggested to provide a good initial experience
|
|
||||||
# with RSpec, but feel free to customize to your heart's content.
|
|
||||||
=begin
|
|
||||||
# These two settings work together to allow you to limit a spec run
|
|
||||||
# to individual examples or groups you care about by tagging them with
|
|
||||||
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
|
||||||
# get run.
|
|
||||||
config.filter_run :focus
|
|
||||||
config.run_all_when_everything_filtered = true
|
|
||||||
|
|
||||||
# Limits the available syntax to the non-monkey patched syntax that is
|
|
||||||
# recommended. For more details, see:
|
|
||||||
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
|
||||||
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
||||||
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
|
||||||
config.disable_monkey_patching!
|
|
||||||
|
|
||||||
# Many RSpec users commonly either run the entire suite or an individual
|
|
||||||
# file, and it's useful to allow more verbose output when running an
|
|
||||||
# individual spec file.
|
|
||||||
if config.files_to_run.one?
|
|
||||||
# Use the documentation formatter for detailed output,
|
|
||||||
# unless a formatter has already been configured
|
|
||||||
# (e.g. via a command-line flag).
|
|
||||||
config.default_formatter = 'doc'
|
|
||||||
end
|
|
||||||
|
|
||||||
# Print the 10 slowest examples and example groups at the
|
|
||||||
# end of the spec run, to help surface which specs are running
|
|
||||||
# particularly slow.
|
|
||||||
config.profile_examples = 10
|
|
||||||
|
|
||||||
# Run specs in random order to surface order dependencies. If you find an
|
|
||||||
# order dependency and want to debug it, you can fix the order by providing
|
|
||||||
# the seed, which is printed after each run.
|
|
||||||
# --seed 1234
|
|
||||||
config.order = :random
|
|
||||||
|
|
||||||
# Seed global randomization in this process using the `--seed` CLI option.
|
|
||||||
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
||||||
# test failures related to randomization by passing the same `--seed` value
|
|
||||||
# as the one that triggered the failure.
|
|
||||||
Kernel.srand config.seed
|
|
||||||
=end
|
|
||||||
end
|
|
@ -1,17 +0,0 @@
|
|||||||
RSpec.configure do |config|
|
|
||||||
|
|
||||||
config.before(:suite) do
|
|
||||||
# The :transaction strategy prevents :after_commit hooks from running
|
|
||||||
DatabaseCleaner.strategy = :transaction
|
|
||||||
DatabaseCleaner.clean_with(:truncation)
|
|
||||||
# load seeds only for test
|
|
||||||
load "#{Rails.root}/db/test_seeds.rb"
|
|
||||||
end
|
|
||||||
|
|
||||||
config.around(:each) do |example|
|
|
||||||
DatabaseCleaner.cleaning do
|
|
||||||
example.run
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,12 +0,0 @@
|
|||||||
RSpec.configure do |config|
|
|
||||||
config.include FactoryGirl::Syntax::Methods
|
|
||||||
|
|
||||||
config.before(:suite) do
|
|
||||||
begin
|
|
||||||
DatabaseCleaner.start
|
|
||||||
FactoryGirl.lint
|
|
||||||
ensure
|
|
||||||
DatabaseCleaner.clean
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
x
Reference in New Issue
Block a user