-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #564 from cortex-cms/topic/example-specs
Factories + Spec Config + Example Spec
- Loading branch information
Showing
27 changed files
with
267 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ unnecessary re-work if a problem and its potential solution are first discussed | |
* Fork on Github, then clone your repo: | ||
|
||
```sh | ||
git clone [email protected]:your-username/cortex.git | ||
$ git clone [email protected]:your-username/cortex.git | ||
``` | ||
|
||
* Follow the [setup instructions][setup] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'rails_helper' | ||
|
||
module Cortex | ||
RSpec.describe ApplicationController, type: :controller do | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FactoryBot.define do | ||
factory :content_item do | ||
state {%w(draft published).sample} | ||
association :creator, factory: :user | ||
content_type | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FactoryBot.define do | ||
factory :content_type do | ||
name {Faker::Commerce.product_name} | ||
contract | ||
description {Faker::Lorem.sentence(4, false, 0)} | ||
association :creator, factory: :user | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FactoryBot.define do | ||
factory :cortex_contract, class: 'Cortex::Contract' do | ||
name {Faker::Lorem.word} | ||
association :tenant, factory: :cortex_tenant | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FactoryBot.define do | ||
factory :cortex_decorator, class: 'Cortex::Decorator' do | ||
name 'Wizard' | ||
data {{}} | ||
association :tenant, factory: :cortex_tenant | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FactoryBot.define do | ||
factory :field do | ||
content_type | ||
field_type {"text_field_type"} | ||
required false | ||
name {Faker::Lorem.word} | ||
name_id {name.downcase} | ||
validations {{}} | ||
metadata {{}} | ||
|
||
trait :slug do | ||
validations {{length: {maximum: 75}, presence: true, uniqueness: true}} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FactoryBot.define do | ||
factory :field_item do | ||
data {{}} | ||
field | ||
content_item | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FactoryBot.define do | ||
factory :cortex_tenant, class: 'Cortex::Tenant' do | ||
sequence(:name) {|n| "tenant #{n}"} | ||
sequence(:name_id) {|n| "tenant_#{n}"} | ||
description {Faker::Lorem.sentence(4, false, 0)} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FactoryBot.define do | ||
factory :cortex_user, class: 'Cortex::User' do | ||
firstname {Faker::Name.first_name} | ||
lastname {Faker::Name.last_name} | ||
email {Faker::Internet.unique.safe_email} | ||
password {Faker::Internet.password} | ||
|
||
transient do | ||
tenants_count 5 | ||
end | ||
|
||
after(:create) do |user, evaluator| | ||
create_list(:cortex_tenant, evaluator.tenants_count, users: [user], owner: user) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'rails_helper' | ||
|
||
module Cortex | ||
RSpec.describe ApplicationHelper, type: :helper do | ||
end | ||
end |
Oops, something went wrong.