-
Notifications
You must be signed in to change notification settings - Fork 0
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 #3 from dbii/develop
Release 002
- Loading branch information
Showing
13 changed files
with
168 additions
and
25 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
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 |
---|---|---|
@@ -1,2 +1,9 @@ | ||
module ExpertsHelper | ||
|
||
def introduction_path(expert, target) | ||
experts = expert.path_to_expert(target) | ||
return "Sorry, no introduction path" unless experts | ||
experts.map{|e| e.name}.join(" => ") | ||
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<h3>Experts</h3> | ||
<p>Welcome to the Experts Exchange</p> | ||
<p><%= link_to "Find experts", experts_path %> who will meet your needs!</p> |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FactoryBot.define do | ||
factory :expert do | ||
name {"Jane Expert"} | ||
sequence(:name) { |n| "Jane Expert#{n}" } | ||
url {"https://en.wikipedia.org/wiki/Dog_training"} | ||
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 :friendship do | ||
expert_1_id { 1 } | ||
expert_2_id { 2 } | ||
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,26 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Friendship, type: :model do | ||
|
||
let(:expert_1) { create :expert } | ||
let(:expert_2) { create :expert } | ||
let(:valid_attributes) { { expert_1_id: expert_1.id, expert_2_id: expert_2.id } } | ||
|
||
context "when creating a friendship" do | ||
it "is valid with expected valid attributes" do | ||
expect(Friendship.new(valid_attributes)).to be_valid | ||
end | ||
|
||
it "requires expert 1" do | ||
expect(Friendship.new(valid_attributes.merge(expert_1_id: nil))).not_to be_valid | ||
end | ||
|
||
it "requires expert 2" do | ||
expect(Friendship.new(valid_attributes.merge(expert_2_id: nil))).not_to be_valid | ||
end | ||
|
||
it "doesn't allow experts to be friends with themselves" do | ||
expect(Friendship.new(valid_attributes.merge(expert_2_id: expert_1.id))).not_to be_valid | ||
end | ||
end | ||
end |