This file contains hidden or 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
require 'rails_helper' | |
RSpec.describe LinkMetaPresenter do | |
let(:article) do | |
double(:article, | |
title: title, # Using variables for each of these allows us to swap out the data in different scenarios | |
html_title: html_title, | |
description: description, | |
author: author, | |
twitter_card: twitter_card) |
This file contains hidden or 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 LinkMetaPresenter | |
def initialize(article) # Define article as the object passed to LinkMetaPresenter(@article) in our article_controller so we can access it here | |
@article = article | |
end | |
attr_reader :article # Provide read access to the 'article' variable within this file | |
delegate :twitter_card, to: :article # Define 'twitter_card' as 'article.twitter_card' | |
def card_type |
This file contains hidden or 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
var PLAYERS = [ | |
{ | |
id: 1, | |
name: 'Steve Brewer', | |
score: 100, | |
}, | |
{ | |
id: 2, | |
name: 'Sam McTaggart', | |
score: 1, |