text
stringlengths
10
2.61M
require "rails_helper" RSpec.feature "User can navigate straight back to root page from any location via the navbar" do context "When user is on any page" do scenario "they can navigate directly back to the home page" do test_page = Page.create(title: "test title one", content: "test content one", slug: "t...
class AddRegToCompanys < ActiveRecord::Migration[5.0] def change add_column :companies, :region, :string end end
# encoding: utf-8 require 'spec_helper' describe SimpleSpreadsheet do describe "Open Openoffice (.ods) file read-only mode" do before do @workbook = SimpleSpreadsheet::Workbook.read(File.join(File.dirname(__FILE__), "fixtures/file.ods")) end it "should can open the file" do @workbook.shoul...
require File.dirname(__FILE__) + '/../test_helper' require 'article_banners_controller' # Re-raise errors caught by the controller. class ArticleBannersController; def rescue_action(e) raise e end; end class ArticleBannersControllerTest < Test::Unit::TestCase fixtures :article_banners def setup @controller =...
class BitLevelFileGroupsController < FileGroupsController def create_initial_cfs_assessment @file_group = BitLevelFileGroup.find(params[:id]) @file_group.ensure_cfs_directory authorize! :create_cfs_fits, @file_group if @file_group.is_currently_assessable? @file_group.schedule_initial_cfs_assess...
class VideoPolicy < ApplicationPolicy alias index? user_renewal_date_is_in_future? alias show? user_renewal_date_is_in_future? end
require "pry" require_relative "artist.rb" require_relative "song.rb" class MP3Importer attr_accessor :path @files_arr = [] def initialize(path) #initialize with path @path = path self.files end def import # binding.pry @files_arr.each do |f...
class User < ActiveRecord::Base include Tokenable validates_presence_of :email, :password, :full_name validates_uniqueness_of :email has_secure_password has_many :reviews has_many :queue_items, -> {order(position: :asc)} has_many :videos, through: :queue_items has_many :leading_relationships, class_na...
module Nhim class BaseModel < ::ActiveRecord::Base self.abstract_class = true def self.belongs_to(relationship, options={}) options[:optional] = true if ActiveRecord::VERSION::MAJOR >= 5 super(relationship, options) end end end
require_relative '../../token' module Tokenizer module Oracles class Value private_class_method :new class << self # Returns true if value is a primitive or a reserved keyword variable. def value?(value) !type(value).nil? end # rubocop:disable Metrics/Cyclo...
# frozen_string_literal: true class AddDescriptionToCommittees < ActiveRecord::Migration[6.1] def change add_column :committees, :description, :text end end
class EntriesController < ApplicationController def index @entries = Entry.all end def show if !(params[:id].blank?) @entry = Entry.find(params[:id]) else redirect_to(@entries) and return end end def create entry = Entry.create(entry...
class Zipcode attr_accessor :zipcode def initialize(zipcode=nil) @zipcode = zipcode.to_s.rjust(5, "0")[0..4] end end
require 'rails_helper' RSpec.describe 'User#update', type: :system do let(:user_page) { UserPage.new } before { log_in admin_attributes } it 'completes basic' do user = user_create user_page.load id: user.id expect(user_page.title).to eq 'Letting - Edit User' user_page.fill_form 'nother', 'not...
# == Schema Information # # Table name: messages # # id :integer not null, primary key # body :text not null # author_id :integer not null # channel_id :integer not null # edited :boolean default(FALSE), not null # created_at :datetime not...
# frozen_string_literal: true require 'gomail/version' require 'gomail/client' module Gomail Error = Class.new(RuntimeError) SchemaError = Class.new(Error) end
require 'test_helper' class SteamProfileTest < ActiveSupport::TestCase # Test to validate that, based on vanity_name, SteamProfiles automatically # retrieve the steam_id when created. test 'should autopopulate steam_id when saving' do VCR.use_cassette('steam_api_requests') do p = SteamProfile.create( ...
# Copyright (c) 2015 Vault12, Inc. # MIT License https://opensource.org/licenses/MIT require 'utils' module Errors # Root class for our internal ZAX errors # # Relay internal errors will inherit from ZAXError. # Catch block handles 3 types of errors: # - RbNaCl::CryptoError for encryption # - ZAXError of r...
module Puppet::Parser::Functions newfunction(:get_resource, :type => :rvalue, :doc => "Traverses the catalog for a resource and returns the whole resource as a hash, or optionally if you provide the second arg, that particular parameter of the resource. For example: ...
require 'rails_helper' RSpec.describe SettingsController, type: :controller do describe 'GET #index' do context 'User is not signed in' do before do get :index end include_examples 'redirects as un-authenticated user' end context 'User is signed in' do before do a...
require "test_helper" describe MerchantsController do it "can successfully log in with github as an existing merchant" do iron_chef = merchants(:iron_chef) perform_login(iron_chef) must_redirect_to root_path expect(session[:merchant_id]).must_equal iron_chef.id # expect(flash[:status]).must_eq...
class Reader attr_reader :file_name def initialize(file) @file_name = file end def read File.read(file_name).chomp end end
class AddSubmitterToTexts < ActiveRecord::Migration def change change_table :texts do |t| t.integer :submitter_id, default: 1, null: false end add_index :texts, :submitter_id end end
# encoding: UTF-8 class Film # Raccourcis vers les METADATA # ---------------------------- def metadata ; @metadata ||= collecte.metadata.data end # {String} Identifiant du film dans le Filmodico # Pour le moment, ne peut être défini qu'explicitement. def id ; @id ||= metadata[:id] end # {Strin...
load 'config/deploy/unicorn' load 'config/deploy/release' load 'config/deploy/delayed_job' require 'bundler/capistrano' require 'delayed/recipes' namespace :deploy do task :test_path, :roles => :app do run "env | grep -i path" end desc "deploy application" task :start, :roles => :app do end desc "initiali...
class CreateWorkflowItemIngestRequests < ActiveRecord::Migration def change create_table :workflow_item_ingest_requests do |t| t.references :workflow_project_item_ingest, index: false, foreign_key: true t.references :item, index: false, foreign_key: true t.timestamps null: false end add...
class InitiativesController < ApplicationController def index @search = Initiative.search(params[:q]) @initiatives = Initiative.search_with_options(params[:q], {page: params[:page], order: params[:order]}) @initiatives = @initiatives.by_subject_id(params[:subject_id]) if params[:subject_id] @subjects ...
class BinaryHeap attr_accessor :heap_list, :current_size def initialize @heap_list = [0] @current_size = 0 end def perc_up(i) while i / 2 > 0 do if self.heap_list[i] < self.heap_list[i / 2] tmp = self.heap_list[i / 2] self.heap_list[i / 2] = self.heap_list[i] self.hea...
require File.dirname(__FILE__) + '/../../../spec_helper' describe "File::Stat#dev_major" do platform_is_not :windows do it "returns the major part of File::Stat#dev" do File.stat(FileStatSpecs.null_device).dev_major.should be_kind_of(Integer) end end platform_is :windows do it "returns the num...
class User < ApplicationRecord has_secure_password validates_presence_of :username, :email validates_uniqueness_of :username, :email belongs_to :game, required: false has_many :cards end
class CreateCards < ActiveRecord::Migration[6.0] def change create_table :cards do |t| t.string :playername t.string :team t.integer :year t.string :card_company t.integer :user_id end end end
Signal.trap("INT") do exit end Signal.trap("TERM") do exit end def cargo_build(mode = "") mode = "--#{mode.to_s}" unless mode.nil? system "cargo build #{mode}" or exit!(1) end def cmd_args if ARGV.include? '--' ARGV .join(' ') .split('--', 2) .last end end def run(mode, bin) cmd...
require 'account_activity' require 'timecop' describe AccountActivity do subject { AccountActivity.new(10, 5) } before do Timecop.freeze(Date.parse("11/06/2020")) end it 'holds the balance' do expect(subject.balance).to eq(10) end it 'holds the value by which the balance ...
module IOTA module Crypto class RubyCurl NUMBER_OF_ROUNDS = 81 HASH_LENGTH = 243 STATE_LENGTH = 3 * HASH_LENGTH TRUTH_TABLE = [1, 0, -1, 1, -1, 0, -1, 1, 0] def initialize(rounds = nil) @rounds = rounds || NUMBER_OF_ROUNDS reset end def reset @st...
module Renamer class Files COMMON_RATIO = 0.70 # if a string is in 70% of filenames, it is common attr_accessor :directory, :files, :parts, :duplicate_parts, :common_duplicate_parts, :known_episodes, :use_alternate_naming def initialize directory @directory = directory @files = @parts = @du...
class PortfolioItem < ApplicationRecord belongs_to :portfolio validates_uniqueness_of :symbol, scope: :portfolio_id end
Rails.application.routes.draw do devise_for :ad_users, path: 'ad_users' ,controllers: { sessions: 'ad_users/sessions', registrations: 'ad_users/registrations' } devise_for :st_users, path: 'st_users' ,controllers: { sessions: 'st_users/sessions', registrations: 'st_users/registrations' } # For...
Puppet::Type.newtype(:f5_pool) do @doc = "Manage F5 pool." apply_to_device ensurable do defaultvalues defaultto :present end valid_lb_methods = ["ROUND_ROBIN", "RATIO_MEMBER", "LEAST_CONNECTION_MEMBER", "OBSERVED_MEMBER", "PREDICTIVE_MEMBER", "RATIO_NODE_ADDRESS", "LEAST_CONNECTION_NO...
class Note < ActiveRecord::Base extend FriendlyId friendly_id :name, use: [:slugged, :finders] acts_as_votable belongs_to :user has_many :comments , :dependent => :destroy validates_presence_of :name has_many :notearticles, :dependent => :destroy accepts_nested_attributes_for :note...
Gem::Specification.new do |gem| gem.name = 'foreman-export-nature' gem.version = '0.0.8' gem.date = Date.today.to_s gem.add_dependency 'foreman', '>= 0.59.0' gem.add_development_dependency 'rspec', '~> 2.8.0' gem.add_development_dependency 'fuubar' gem.add_development_dependency 'ZenTest', '~> 4...
# Construir un programa que permita ingresar un número por teclado e imprimir # la tabla de multiplicar del número ingresado. Debe repetir la operación hasta # que se ingrese un 0 (cero). # Ingrese un número (0 para salir): _ num=1 while num !=0 do puts 'ingrese un numero para ver su tabla de multiplicar' puts 'Ingres...
class ServicesController < ApplicationController before_filter :find_service, :except => :index # list all services def index @services = Infosell::Service.all((authenticated_user.try(:infosell_requisite) || '').to_param).select(&:accessible?) end # extended service description def show en...
class VenuesController < ApplicationController def show @venue = Venue.find_by(name: CGI.unescape(params[:id])) end end
# -*- coding : utf-8 -*- module Mushikago module Hanamgri class DeleteDictionaryRequest < Mushikago::Http::DeleteRequest def path; "/1/hanamgri/dictionary" end request_parameter :dictionary_name def initialize dictionary_name, options={} super(options) self.dictionary_name...
# frozen_string_literal: true # Model for user informations class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validata...
class Paddle @@image = Rubygame::Surface.load_image("resources/paddle.png") def initialize(x, y, min_y, max_y) @step = 10 @x = x @y = y @min_y = min_y @max_y = max_y end def Paddle.height @@image.height end def Paddle.width @@image.widt...
module Models class SmartRequest < ActiveRecord::Base belongs_to :app validates :ip, :geolocation, :status, presence: true validates :started_at, :ended_at, presence: true end end
module IOTA module Utils class ObjectValidator def initialize(keysToValidate) @validator = InputValidator.new @keysToValidate = keysToValidate end def valid?(object) valid = true @keysToValidate.each do |keyToValidate| key = keyToValidate[:key] ...
require 'rails_helper' describe FamilyBuilder do describe "#create_family_with_memberships" do it 'creates a new family' do user = FactoryGirl.create(:user) family_params = { name: "dixon" } builder = FamilyBuilder.new(family_params, user) families = Family.count builder.send(:cre...
class Customer < ActiveRecord::Base has_many :devices has_many :business_accounts has_many :accounting_types def lookup_accounting_category lookups = {} accounting_types.each do |at| lookups["accounting_categories[#{at.name}]"] = Hash[Hash[at.accounting_categories.pluck(:name, :id)].map{ |k,v| [k...
require "contracts" class Employee < ActiveRecord::Base include Contracts::Core include Contracts::Builtin validates_presence_of :first_name, :last_name, :email validates_format_of :email, with: /\A[\w\._%\-\+]+@[\w\.-]+\.[a-zA-Z]{2,4}\z/ attr_reader :tag_ids belongs_to( :department, class_name:...
# frozen_string_literal: true source "https://rubygems.org" gem "rake", "~> 13.0" group :development do gem "launchy", "~> 2.3" gem "pry" gem "pry-byebug" end # group :test do gem "cucumber", "~> 3.0" gem "jekyll_test_plugin" gem "jekyll_test_plugin_malicious" gem "memory_profiler" gem "nokogiri", ...
class ShoppingCartsController < ApplicationController before_action :user_id before_action :prd, only: %i[create destroy] before_action :prod, only: :index helper_method :prod def index @total = 0 if user_signed_in? if !current_user.admin? seed_cart else error(products_path...
get '/comments' do @comments = Comment.order('id desc').limit(20) erb :comments_agg end
class QueryResult attr_accessor :columns attr_accessor :resultset attr_accessor :stats def initialize(response, opts = {}) # The response for any query is expected to be a nested array. # If compact (RedisGraph protocol v2) # The resultset is an array w/ three elements: # 0] Node/Edge key names...
json.user do json.__typename 'User' json.id @user.id.to_s json.name @user.name json.avatarUrl @user.avatar_url json.followerCount @user.follower_count json.followingCount @user.following_count json.followedByMe @user.followed_by?(current_user) end
module Opener module KAF class Term attr_reader :document attr_reader :node def initialize document, node @document = document @node = node end def id @id ||= @node.attr :tid end def lemma @node.attr :lemma end def text...
# coding: utf-8 require "bundler" Bundler.setup(:rakefile) begin require "vlad" require "vlad/core" require "vlad/git" # Deploy config set :repository, "git@github.com:oleander/aftonbladet-most-read.git" set :revision, "origin/master" set :deploy_to, "/opt/apps/aftonbladet-most-read" set :d...
require "httparty" module Scraper module HearingsRequest # Fetches a page of committee hearings for the given chamber # Parameters: # - chamber: a Chamber model to fetch hearings for # - page_number: the page of committee hearings to fetch # Returns: # - a map of committee id -> committ...
# Exception Handling is a specific process that deals with errors in a manageable and predictable way. # Ruby has an Exception class that makes handling these errors much easier. It also has a syntactic structure using the reserved words begin, rescue, and end to signify exception handling. The basic structure looks l...
class ChangeReferenceIdToBeBigIntInMeasurementsReferences < ActiveRecord::Migration[5.2] def up change_column :measurements_references, :reference_id, :integer, using: 'reference_id::integer' end def down change_column :measurements_references, :reference_id, :boolean, using: 'reference_id::boolean' en...
require 'spec_helper' describe FunctionsController do ignore_authorization! let(:user) { users(:the_collaborator) } before do log_in user end describe "#index" do let(:database) { schema.database } let(:schema) { gpdb_schemas(:default) } before do @functions = [ GpdbSchema...
class SharedContact < ActiveRecord::Base belongs_to :user belongs_to :consultant validates :user, presence: true, uniqueness: { scope: :consultant } validates :consultant, presence: true validates :allowed, presence: true end
require 'faker' FactoryBot.define do factory :user do name { Faker::Name.name } position { Faker::Job.position } area { Faker::Job.field } world { Faker::Company.name } end end
class Democracy::SimpleCount def tally(ballots) counts = Hash.new(0) ballots.each do |ballot| cand = ballot.preferences.first unless ballot.preferences.empty? counts[cand] += 1 unless cand.nil? end counts end end
require 'yaml' MESSAGE = YAML.load_file('exercises.yml') =begin #1 How old is Teddy, uild a program that randomly generates and prints Teddy's age #To get the age generate a random number between 20 and 200 #PEDAC #Using a random number generator get the age of Teddy to appear #E: example/test cases #If I have a ra...
# input: num # output: sum of the multiples of a given num (3 and 5 if none are give) but not including num # data structure arr and integer # # rules: one is counted, but not num itself class SumOfMultiples def initialize(*multiples) @multiples = multiples end def self.to(limit) (1..limit).to_a.inject...
class KitOrder < ActiveRecord::Base belongs_to :order belongs_to :kit end
# frozen_string_literal: true class LiquidBook < SiteBuilder def build site.components_load_paths.each do |path| load_liquid_components(path) end layouts = Bridgetown::LayoutReader.new(site).read @components.each do |component_filename, component_object| doc "#{component_filename}.html" ...
require 'test_helper' class GsParametersControllerTest < ActionController::TestCase setup do @gs_parameter = gs_parameters(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:gs_parameters) end test "should get new" do get :new assert_res...
# # controller.rb # filemate # # Created by Vladimir Chernis on 2/9/12. # Copyright 2012 __MyCompanyName__. All rights reserved. # class FIMAController MAX_NUM_FILES = 100 attr_writer :filelist_tableview attr_accessor :filename_textfield attr_writer :path_control attr_writer :fileicon...
require 'spec_helper' describe DiffResource do before do @parser = DiffResource::JsonParser.new({ "root" => "root.data", "key" => "key", "value" => "value" }) end it "parse json" do ret = @parser.parse <<-EOS { "root" :{ "data" : [ { "key" : "string1", "value" : "hello" } ] } } EOS ...
require File.dirname(__FILE__) + '/../spec_helper' describe DeletedIssue do before do Site.delete_all @deleted_issue = Factory :deleted_issue end describe "methods:" do describe "restore" do it "should restore DeleteIssue back to Issue" do Issue.find_by_id(@deleted_issue.id).should ...
# frozen_string_literal: true class AddIndexToSubjects < ActiveRecord::Migration[4.2] def change add_index :subjects, ["title"], :name => "index_subjects_title", :unique => true end end
class AddSpecialistRefToTreatments < ActiveRecord::Migration[5.0] def change add_reference :treatments, :specialist, foreign_key: true, index: true add_reference :treatments, :subcategory, foreign_key: true, index: true end end
class TweetsController < ApplicationController before_action :set_tweet, only:[:like, :unlike] def index @tweets = Tweet.includes(:user, :likes, :liked_users).order(created_at: :desc) @tweet = Tweet.new @users = User.order(followers_count: :desc).limit(10) #基於測試規格,必須講定變數名稱,請用此變數中存放關注人數 Top 10 的使用者...
require_relative '../lib/play' describe '#play' do it 'calls turn nine times' do board = [" ", " ", " ", " ", " ", " ", " ", " ", " "] expect(self).to receive(:turn).at_least(9).times play(board) end end
class NovaScotia def scrape_people party_ids = {} { 'Nova Scotia Liberal Party' => ['LIB'], 'Nova Scotia New Democratic Party' => ['NDP'], 'Progressive Conservative Association of Nova Scotia' => ['PC'], 'Independent' => ['IND'], }.each do |name,abbreviations| organization = Pupa::...
# frozen_string_literal: true require 'rails_helper' describe EventDecorator do describe '#rendered_description' do let(:event) { FactoryBot.create(:event, :with_markdown).decorate } it { expect(event.rendered_description).to eq %(<p>I&#39;m <strong>description</strong> with <em>markdown</em>.</p>\n) } e...
class CompareSort def self.run(info) data = info[:data] sorting_method = info[:sorting_method] timer = info[:timer] ValidateData.run(data) if timer sort = lambda { eval(sorting_method).run(data) } return self.timer(sort) else return eval(sorting_method).run(data) end end def self.timer(s...
module RailsParam module ErrorMessages class CannotBeLessThanMessage < RailsParam::ErrorMessages::BaseMessage def to_s "Parameter #{param_name} cannot be less than #{value}" end end end end
class TasksController < ApplicationController def new @task = Task.new end def create @project = Project.find(params[:article_id]) @task = @project.tasks.create(task_params) redirect_to project_path(@project) end private def task_params params.require(:task).permit(:title, :descriptio...
require 'ffaker' require File.expand_path("#{APP_ROOT}/run/api", __FILE__) describe HomeApi do def app Api.new end before do @url_1 = FFaker::Internet.http_url end describe 'get /:key' do it '通过key获取链接' do get '/000001' expect(last_response.status).to eq 404 ShortUrl.create_...
module TLAW # Base parameter class for working with parameters validation and # converting. You'll never instantiate it directly, just see {DSL#param} # for parameters definition. # class Param # This error is thrown when some value could not be converted to what # this parameter inspects. For example...
# Ingredients Controller class IngredientsController < ApplicationController helper_method :sort_column, :sort_direction # Authentication and Authorization hacks # before_action :authenticate_user! load_and_authorize_resource before_action :set_ingredient, only: [:show, :edit, :update, :destroy] # GET /in...
class LicenceController < ApplicationController include Previewable include Cacheable include Navigable before_action :set_content_item helper_method :postcode INVALID_POSTCODE = "invalidPostcodeFormat".freeze NO_LOCATION_ERROR = "validPostcodeNoLocation".freeze NO_MATCHING_AUTHORITY = "noLaMatch".fr...
require_relative '../grid' require 'test/unit' class TestCell < Test::Unit::TestCase def test_peers grid = Grid.new(4) grid.each_cell do | cell | assert_equal(7, cell.peers.count) end end def test_exclude cell = Cell.new(0, 0) assert_equal([], cell.excluded_values) cell.exclude(1) asser...
require "rails_helper" describe "routes for repos" do it "routes GET /repo/foo.bar to the repositories controller" do expect(get("/repo/foo.bar")).to route_to( controller: "repositories", action: "show", repo: "foo.bar" ) end end describe "routes redirect for repos", type: :req...
require 'rails_helper' RSpec.describe Comment, type: :model do # let(:my_user) { create(:user, confirmed_at: DateTime.now) } # let(:my_cat) { create(:category) } # let(:my_post) { create(:post, category: my_cat, user: my_user ) } # let(:my_comment) { create(:comment, post: my_post, user: my_user ) } # #...
class BuildHistoriesController < ApplicationController include SetBuildHistories protect_api only: :create before_action :find_scenario, only: %i[index create] before_action :find_build_history, except: %i[index create] before_action :set_scenario, except: %i[index create] before_action :set_project def...
module ApplicationHelper include Pagy::Frontend def pagy_govuk_nav(pagy) render "pagy/paginator", pagy: pagy end def markdown(source) render = Govuk::MarkdownRenderer # Options: https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use # lax_spacing: HTML blocks do not require to be s...
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.require_version ">= 1.8.4" vm_hostname = "nodejs.mycompany.local" Vagrant.configure("2") do |config| config.vm.box = "server4001/nodejs-mysql-centos" config.vm.box_version = "0.1.0" config.vm.network :private_network, ip: "10.20.0.92" config.vm.hostname = "...
require "rails_helper" describe MarkPatientMobileNumbers, type: :model do it "marks non-mobile patient phone numbers as mobile" do mobile_number = create(:patient_phone_number, phone_type: "mobile") non_mobile_number = create(:patient_phone_number, phone_type: "landline") nil_type_number = create(:patien...
# frozen_string_literal: true require 'forwardable' module Apartment # The main entry point to Apartment functions # module Tenant extend self extend Forwardable def_delegators :adapter, :create, :drop, :switch, :switch!, :current, :each, :reset, :init, :set_callback, :seed, :d...
module Misspelling class Cli def initialize @options = {} end def run(args = ARGV) options = Misspelling::Options.new.parse(args) runner = Misspelling::Runner.new(options: options) runner.start runner.show_result end end end
require 'spec_helper' describe "email_templates/edit" do before(:each) do @email_template = assign(:email_template, stub_model(EmailTemplate, :name => "MyString", :language => "MyString", :content => "MyText" )) end it "renders the edit email_template form" do render # Run the...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
class ExpectedCalls attr_reader :calls, :executed_calls def initialize @calls = [] @executed_calls = [] @validate = [Proc.new{@current_call.count > 0}] end def add_call(call) @calls.push(@current_call = call) self end def with_params(*args) @current_call.params = args self ...
require 'spec_helper' describe RemoteImageSearchResultSerializer do let(:image_model) { RemoteImage.new } it 'exposes the attributes to be jsonified' do serialized = described_class.new(image_model).as_json expected = [:source, :description, :is_official, :is_trusted, :star_count, :registry_id, :registry_...
class UserSerializer < ActiveModel::Serializer attributes :id, :username, :password, :first_name, :last_name has_many :tags has_many :favorites has_many :favorite_tags, through: :tags has_many :destinations, through: :favorites end