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
class EventsController < ApplicationController | |
def index | |
+ @events = [Event.new] | |
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
class Event | |
def visitor | |
User.last # hardcoded for now | |
end | |
def action | |
"liked" # hardcoded for now | |
end | |
def recipe |
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
scenario "Viewing events" do | |
+ visitor = User.create!(name: "Visitor Name") | |
+ visitor.recipes.create!(title: "Featured Visitor Recipe") | |
+ Recipe.create!(title: "Visited Recipe") | |
+ | |
visit events_path | |
- expect(page).to have_text "Grilled aubergines" | |
+ expect(page).to have_text "Visitor Name" | |
+ expect(page).to have_text "Featured Visitor Recipe" |
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
scenario "Viewing events" do | |
+ visitor = User.create!(name: "Visitor Name") | |
+ visitor.recipes.create!(title: "Featured Visitor Recipe") | |
+ Recipe.create!(title: "Visited Recipe") | |
+ | |
visit events_path | |
- expect(page).to have_text "Grilled aubergines" | |
+ expect(page).to have_text "Visitor Name" | |
+ expect(page).to have_text "Featured Visitor Recipe" |
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
class CreateEvents < ActiveRecord::Migration[5.2] | |
def change | |
create_table :events do |t| | |
t.references :visitor, null: false | |
t.references :recipe, null: false | |
t.integer :action, null: false | |
t.timestamps | |
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
@@ Model @@ | |
-class Event | |
- def visitor | |
- User.last | |
- end | |
- | |
- def action | |
- "liked" | |
- 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
scenario "Viewing events" do | |
visitor = User.create!(name: "Visitor Name") | |
visitor.recipes.create!(title: "Featured Visitor Recipe") | |
- Recipe.create!(title: "Visited Recipe") | |
+ visited_recipe = Recipe.create!(title: "Visited Recipe") | |
+ Event.create!(visitor: visitor, recipe: visited_recipe, action: :liked) |
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
<!-- layouts/application.html.erb --> | |
<div data-controller="modal"> | |
<%= link_to "Get Started", "#", data-action="modal#show" %> | |
<div data-target="modal.dialog" style="display: none;"> | |
<% form_for authentications_path do |f| %> | |
<!-- Form markup --> | |
<% end %> | |
</div> | |
</div> |
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
<!-- layouts/application.html.erb --> | |
<%= link_to "Get Started", new_authentication_path %> |
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
class AuthenticationsController < ApplicationController | |
def new | |
@authentication = Authentication.new | |
track_login_start | |
end | |
end |