This repository has been archived by the owner on Jul 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
144 additions
and
7 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 |
---|---|---|
|
@@ -195,4 +195,4 @@ DEPENDENCIES | |
shoulda-matchers (~> 3.1) | ||
|
||
BUNDLED WITH | ||
1.12.4 | ||
1.12.5 |
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 @@ | ||
module Shareconomy | ||
class Location < ActiveRecord::Base | ||
belongs_to :listing | ||
|
||
validates :state, :city, :district, :street, :zip_code, :listing, presence: true | ||
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 @@ | ||
module Shareconomy | ||
class Rating < ActiveRecord::Base | ||
belongs_to :listing | ||
|
||
validates :title, :content, :value, :listing, presence: true | ||
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,14 @@ | ||
class CreateShareconomyLocations < ActiveRecord::Migration | ||
def change | ||
create_table :shareconomy_locations do |t| | ||
t.string :state | ||
t.string :city | ||
t.string :district | ||
t.string :street | ||
t.string :zip_code | ||
t.integer :listing_id, index: true | ||
|
||
t.timestamps null: false | ||
end | ||
end | ||
end |
File renamed without changes.
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,13 @@ | ||
class CreateShareconomyRatings < ActiveRecord::Migration | ||
def change | ||
create_table :shareconomy_ratings do |t| | ||
t.string :title | ||
t.text :content | ||
t.integer :value | ||
t.integer :listing_id, index: true | ||
t.integer :user_id, index: true | ||
|
||
t.timestamps null: false | ||
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
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,13 @@ | ||
require 'rails_helper' | ||
|
||
module Shareconomy | ||
RSpec.describe Category, type: :model do | ||
context 'relation' do | ||
it { should have_many(:listings) } | ||
end | ||
|
||
context 'validations' do | ||
it { should validate_presence_of(:title) } | ||
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,21 @@ | ||
require 'rails_helper' | ||
|
||
module Shareconomy | ||
RSpec.describe Listing, type: :model do | ||
context 'relation' do | ||
it { should belong_to(:user) } | ||
it { should belong_to(:category) } | ||
it { should have_one(:location) } | ||
it { should have_many(:ratings) } | ||
it { should have_many(:orders) } | ||
end | ||
|
||
context 'validations' do | ||
it { should validate_presence_of(:user) } | ||
it { should validate_presence_of(:title) } | ||
it { should validate_presence_of(:price) } | ||
it { should validate_presence_of(:category) } | ||
it { should validate_presence_of(:description) } | ||
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,18 @@ | ||
require 'rails_helper' | ||
|
||
module Shareconomy | ||
RSpec.describe Location, type: :model do | ||
context 'relation' do | ||
it { should belong_to(:listing) } | ||
end | ||
|
||
context 'validations' do | ||
it { should validate_presence_of(:state) } | ||
it { should validate_presence_of(:city) } | ||
it { should validate_presence_of(:district) } | ||
it { should validate_presence_of(:street) } | ||
it { should validate_presence_of(:zip_code) } | ||
it { should validate_presence_of(:listing) } | ||
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,16 @@ | ||
require 'rails_helper' | ||
|
||
module Shareconomy | ||
RSpec.describe Rating, type: :model do | ||
context 'relation' do | ||
it { should belong_to(:listing) } | ||
end | ||
|
||
context 'validations' do | ||
it { should validate_presence_of(:title) } | ||
it { should validate_presence_of(:listing) } | ||
it { should validate_presence_of(:content) } | ||
it { should validate_presence_of(:value) } | ||
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