source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/mutiplication_operator_spec.rb
Ruby
mit
90
master
496
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'multiplication operator' do let(:interpreter) { Flea::Interpreter.new } it 'should multiply several numbers' do result = interpreter.run('(* 2 2 2)') expect(result).to eq(8) end it 'should eval...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/gets_spec.rb
Ruby
mit
90
master
479
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'gets' do before :each do @interpreter = Flea::Interpreter.new @old_stdin = $stdin @buffer = StringIO.new $stdin = @buffer end it 'should get input from STDIN' do @buffer.string = "...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/car_spec.rb
Ruby
mit
90
master
322
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'car' do let(:interpreter) { Flea::Interpreter.new } it 'should return first item of list' do result = interpreter.run(' (car (quote (10 2 2))) ') expect(result).to eq(10) end end en...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/addition_operator_spec.rb
Ruby
mit
90
master
481
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'addition operator' do let(:interpreter) { Flea::Interpreter.new } it 'should add several numbers' do result = interpreter.run('(+ 1 2 3)') expect(result).to eq(6) end it 'should evaluate its ar...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/division_operator_spec.rb
Ruby
mit
90
master
639
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'division operator' do let(:interpreter) { Flea::Interpreter.new } it 'should divide several integers' do result = interpreter.run('(/ 10 2 2)') expect(result).to eq(2) end it 'should divide sev...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/list_predicate_spec.rb
Ruby
mit
90
master
597
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'list?' do let(:interpreter) { Flea::Interpreter.new } it 'should should return true for an empty list' do result = interpreter.run("(list? (quote ()))") expect(result).to be true end it 'return...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/rand_spec.rb
Ruby
mit
90
master
528
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'rand' do let(:interpreter) { Flea::Interpreter.new } 10.times do it 'should return a random number lower than or equal to 10' do result = interpreter.run('(rand 10)') expect(result).to be < 11...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/subtraction_operator_spec.rb
Ruby
mit
90
master
515
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'subtraction operator' do let(:interpreter) { Flea::Interpreter.new } it 'should subtract several numbers' do result = interpreter.run('(- 9 2 2)') expect(result).to eq(5) end it 'should evaluat...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/lambda_spec.rb
Ruby
mit
90
master
1,674
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'lambda' do before :each do @interpreter = Flea::Interpreter.new @old_stdout = $stdout @buffer = StringIO.new $stdout = @buffer end after :each do $stdout = @old_stdout end ...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/list_spec.rb
Ruby
mit
90
master
531
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'list' do let(:interpreter) { Flea::Interpreter.new } it "should create a list from it's arguments" do result = interpreter.run('(list 9 2 2)') expect(result).to eq([9, 2, 2]) end it 'should eva...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/less_than_spec.rb
Ruby
mit
90
master
728
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'less-than?' do let(:interpreter) { Flea::Interpreter.new } it "return true if it's first argument is smaller than all the others" do result = interpreter.run('(less-than? 5 10 15 20)') expect(result).to...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/read_spec.rb
Ruby
mit
90
master
524
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'read' do before :each do @interpreter = Flea::Interpreter.new @old_stdin = $stdin @buffer = StringIO.new $stdin = @buffer end it 'should read data structure from STDIN' do @buffer....
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/if_spec.rb
Ruby
mit
90
master
1,637
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'if' do let(:interpreter) { Flea::Interpreter.new } context 'only with consequent' do it 'should execute consequent' do interpreter.run(' (if #t (define consequent 1)) ') ...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/quote_spec.rb
Ruby
mit
90
master
419
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'quote' do let(:interpreter) { Flea::Interpreter.new } it 'should quote a list' do result = interpreter.run('(quote (1 2 3))') expect(result).to eq([1, 2, 3]) end it 'should quote a single liter...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/set_spec.rb
Ruby
mit
90
master
543
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'set!' do let(:interpreter) { Flea::Interpreter.new } it 'should change the value of an existing variable' do interpreter.run(' (define test 1) (set! test 2)') expect(interpreter.base_en...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/string_to_num_spec.rb
Ruby
mit
90
master
626
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'string-to-num' do let(:interpreter) { Flea::Interpreter.new } it 'should convert string to integer' do result = interpreter.run('(string-to-num "10")') expect(result).to eq(10) end it 'should c...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/cdr_spec.rb
Ruby
mit
90
master
325
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'cdr' do let(:interpreter) { Flea::Interpreter.new } it 'should return remainder of list' do result = interpreter.run(' (cdr (quote (10 2 2))) ') expect(result).to eq([2, 2]) end end...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/equality_operator_spec.rb
Ruby
mit
90
master
1,097
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'equality operator' do let(:interpreter) { Flea::Interpreter.new } context 'for an expression that should evaluate to true' do it 'should return the equality of several arguments' do result = interpret...
github
aarongough/flea
https://github.com/aarongough/flea
spec/flea/standard_library/display_spec.rb
Ruby
mit
90
master
1,071
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'display' do before :each do @interpreter = Flea::Interpreter.new @old_stdout = $stdout @buffer = StringIO.new $stdout = @buffer end it 'should output simple literal' do @interprete...
github
aarongough/flea
https://github.com/aarongough/flea
lib/flea/interpreter.rb
Ruby
mit
90
master
1,743
# frozen_string_literal: true module Flea class Interpreter attr_accessor :base_environment, :current_environment def initialize(environment: Environment.new, standard_library: true) @base_environment = @current_environment = environment load_standard_library if standard_library end de...
github
aarongough/flea
https://github.com/aarongough/flea
lib/flea/environment.rb
Ruby
mit
90
master
679
# frozen_string_literal: true module Flea class Environment attr_accessor :parent, :table def initialize(parent = nil) @parent = parent @table = {} add_globals if @parent.nil? end def has_variable?(name) return true if @table.key?(name) return false if @parent.nil? ...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
jekyll-notion.gemspec
Ruby
mit
90
main
965
# frozen_string_literal: true require_relative "lib/jekyll-notion/version" Gem::Specification.new do |spec| spec.name = "jekyll-notion" spec.version = JekyllNotion::VERSION spec.authors = ["Enrique Arias"] spec.email = ["emoriarty81@gmail.com"] spec.summary ...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
Gemfile
Ruby
mit
90
main
265
# frozen_string_literal: true source "https://rubygems.org" gemspec group :development, :test do gem "bundler", "~> 2" gem "json", ">= 2.10" gem "rspec", "~> 3.0" gem "rubocop-jekyll", "~> 0.12" gem "simplecov", "~> 0.21" gem "webmock", "~> 3.25" end
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
lib/jekyll-notion.rb
Ruby
mit
90
main
1,008
# frozen_string_literal: true require "jekyll" require "notion" require "notion_to_md" require "logger" require "jekyll-notion/generator" require "vcr" NotionToMd::Logger.level = Logger::ERROR Notion.configure do |config| config.token = ENV.fetch("NOTION_TOKEN", nil) end module JekyllNotion autoload :DocumentWi...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
lib/jekyll-notion/cacheable.rb
Ruby
mit
90
main
1,780
# frozen_string_literal: true require_relative "cassette_manager" module JekyllNotion module Cacheable class << self def configure(cache_dir:, cache_enabled:) @cache_dir = cache_dir @cache_enabled = cache_enabled configure_vcr end def cache_dir # Always return...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
lib/jekyll-notion/cassette_manager.rb
Ruby
mit
90
main
2,562
# frozen_string_literal: true require "yaml" require "fileutils" module JekyllNotion class CassetteManager INDEX_BASENAME = ".pages_index.yml" PAGES_DIR = "pages" def initialize(cache_dir) @cache_dir = cache_dir end def cassette_name_for(id) sanitized_id = sanitize_id(id) # ...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
lib/jekyll-notion/generator.rb
Ruby
mit
90
main
3,456
# frozen_string_literal: true module JekyllNotion class Generator < Jekyll::Generator attr_reader :current_page, :current_db def generate(site) @site = site return unless config? && notion_token? assert_configuration setup @notion_client = Notion::Client.new import_no...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
lib/jekyll-notion/page_without_a_file.rb
Ruby
mit
90
main
881
# frozen_string_literal: true module JekyllNotion class PageWithoutAFile < Jekyll::Page def initialize(site, base, dir, name, new_content) self.content = new_content super(site, base, dir, name) end def read_yaml(base, name, _opts = {}) filename = @path || site.in_source_dir(base, name...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
lib/jekyll-notion/document_without_a_file.rb
Ruby
mit
90
main
386
# frozen_string_literal: true module JekyllNotion class DocumentWithoutAFile < Jekyll::Document def read_content(**_opts) if content =~ YAML_FRONT_MATTER_REGEXP self.content = Regexp.last_match.post_match data_file = SafeYAML.load(Regexp.last_match(1)) merge_data!(data_file, :source...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
lib/jekyll-notion/generators/collection.rb
Ruby
mit
90
main
1,859
# frozen_string_literal: true module JekyllNotion module Generators class Collection < Generator include Collectionable def call if config["data"].nil? notion_pages.each { |notion_page| generate_document(notion_page) } else Data.call(:config => config, :site => si...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
lib/jekyll-notion/generators/generator.rb
Ruby
mit
90
main
1,816
# frozen_string_literal: true module JekyllNotion module Generators # Abstract base class for Notion content generators. # # This class provides a common interface and factory method for creating # Jekyll content from Notion pages. Subclasses must implement the {#call} # method to define their sp...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
lib/jekyll-notion/generators/collectionable.rb
Ruby
mit
90
main
738
# frozen_string_literal: true module JekyllNotion module Generators module Collectionable def page_exists?(collection, notion_page) page_exists = collection.any? do |page| page.data["title"]&.downcase == notion_page.title.downcase end if page_exists Jekyll.logge...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
lib/jekyll-notion/generators/data.rb
Ruby
mit
90
main
1,739
# frozen_string_literal: true module JekyllNotion module Generators class Data < Generator # pages => Array of NotionToMd::Page def call data = if notion_pages.size > 1 notion_pages.map do |page| page.send(:frontmatter_properties).merge({ "content" => conve...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
lib/jekyll-notion/generators/page.rb
Ruby
mit
90
main
816
# frozen_string_literal: true module JekyllNotion module Generators class Page < Generator include Collectionable def call if config["data"].nil? notion_pages.each { |notion_page| generate_page(notion_page) } else Data.call(:config => config, :site => site, ...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/spec_helper.rb
Ruby
mit
90
main
2,283
# frozen_string_literal: true require "jekyll" require File.expand_path("../lib/jekyll-notion", __dir__) require "simplecov" require "webmock/rspec" require "vcr" require "tmpdir" require "fileutils" SimpleCov.start do enable_coverage :branch add_filter "spec/" end ENV["JEKYLL_ENV"] = "test" Jekyll.logger.log_l...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/support/collection_examples.rb
Ruby
mit
90
main
3,351
# frozen_string_literal: true RSpec.shared_examples "a jekyll collection" do |collection_name| it "page is stored in destination directory" do expected_path = site.collections[collection_name].first.destination(".") expect(File).to exist(expected_path) end it "stores every page title in the collection" ...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/support/page_examples.rb
Ruby
mit
90
main
2,269
# frozen_string_literal: true RSpec.shared_examples "a jekyll page" do |page_name| let(:page) do site.pages.find { _1.basename == page_name } end it "stores id into page data" do expect(page.data).to include("id" => "9dc17c9c-9d2e-469d-bbf0-f9648f3288d3") end it "stores created_time into page data"...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/support/golden_helper.rb
Ruby
mit
90
main
1,158
# frozen_string_literal: true # spec/support/golden_helper.rb module GoldenHelper GOLDEN_DIR = File.expand_path("../fixtures/golden", __dir__) def expect_to_match_golden_file(actual_content_or_path, golden_name) actual_content = if actual_content_or_path.is_a?(String) && File.file?(actual_content_or_pat...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/support/page_data_examples.rb
Ruby
mit
90
main
3,440
# frozen_string_literal: true RSpec.shared_examples "a jekyll data object" do |data_name| it "stores id into the data object" do expect(site.data[data_name]).to include("id" => "9dc17c9c-9d2e-469d-bbf0-f9648f3288d3") end it "stores created_time into the data object" do expect(site.data[data_name]).to in...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/support/skip_import.rb
Ruby
mit
90
main
243
# frozen_string_literal: true RSpec.shared_examples "skips import" do before do allow(Notion::Client).to receive(:new) end it "does not instantiate Notion::Client" do expect(Notion::Client).not_to have_received(:new) end end
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/support/golden_examples.rb
Ruby
mit
90
main
1,264
# frozen_string_literal: true RSpec.shared_examples "a page is rendered correctly" do |page_name| it "imports and generates page" do page = site.pages.find { |p| p.basename == page_name } raise "`#{page_name}` not found" if page.nil? expect_to_match_page(page) end end RSpec.shared_examples "a page i...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/unit/cassette_manager_spec.rb
Ruby
mit
90
main
8,790
# frozen_string_literal: true require "spec_helper" RSpec.describe JekyllNotion::CassetteManager do let(:cache_dir) { Dir.mktmpdir("cassette-manager-unit") } let(:manager) { described_class.new(cache_dir) } let(:page_id) { "test-123" } after { FileUtils.rm_rf(cache_dir) } describe "#cassette_name_for" do ...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/unit/cacheable_spec.rb
Ruby
mit
90
main
3,248
# frozen_string_literal: true require "spec_helper" RSpec.describe JekyllNotion::Cacheable do let(:cache_dir) { Dir.mktmpdir("cacheable-unit") } let(:test_class) do Class.new do prepend JekyllNotion::Cacheable attr_reader :id def initialize(id) @id = id end def call ...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/unit/generators/generator_spec.rb
Ruby
mit
90
main
7,739
# frozen_string_literal: true require "spec_helper" RSpec.describe JekyllNotion::Generator do let(:site) { instance_double(Jekyll::Site, :config => site_config) } let(:site_config) { { "notion" => notion_config } } let(:notion_config) { {} } let(:generator) { described_class.new } before do generator.i...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/unit/generators/data_spec.rb
Ruby
mit
90
main
6,161
# frozen_string_literal: true require "spec_helper" RSpec.describe JekyllNotion::Generators::Data do let(:site) do instance_double(Jekyll::Site, :data => site_data, :converters => converters) end let(:site_data) { {} } let(:converters) { [markdown_converter] }...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/unit/generators/collection_spec.rb
Ruby
mit
90
main
5,002
# frozen_string_literal: true require "spec_helper" RSpec.describe JekyllNotion::Generators::Collection do let(:site) do instance_double(Jekyll::Site, :in_source_dir => "/source/path", :collections => collections) end let(:collections) { { "posts" => instance_double(Jekyll::Collection, :docs => []) } } le...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/databases/database_edge_cases_spec.rb
Ruby
mit
90
main
2,655
# frozen_string_literal: true require "spec_helper" RSpec.describe "Databases: edge cases and error handling" do context "with posts collection containing date-based filenames" do let(:config) do Jekyll.configuration( "source" => SOURCE_DIR, "destination" => DEST_DIR, "notion"...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/databases/multiple_databases_spec.rb
Ruby
mit
90
main
2,634
# frozen_string_literal: true require "spec_helper" RSpec.describe "Databases: multiple databases import" do let(:config) do Jekyll.configuration( "source" => SOURCE_DIR, "destination" => DEST_DIR, "collections" => { "articles" => { "output" => true } }, "notion" => { "...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/databases/filtered_database_spec.rb
Ruby
mit
90
main
3,057
# frozen_string_literal: true require "spec_helper" RSpec.describe "Databases: filtered and sorted import" do context "with filter configuration" do let(:filter) { { "property" => "Select", "select" => { "equals" => "select1" } } } let(:config) do Jekyll.configuration( "source" => SOURCE_...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/databases/single_database_spec.rb
Ruby
mit
90
main
2,392
# frozen_string_literal: true require "spec_helper" RSpec.describe "Databases: single database import" do let(:config) do Jekyll.configuration( "source" => SOURCE_DIR, "destination" => DEST_DIR, "notion" => { "databases" => [{ "id" => "1ae33dd5f3314402948069517fa40ae2" }], # ...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/databases/duplicate_databases_spec.rb
Ruby
mit
90
main
2,907
# frozen_string_literal: true require "spec_helper" RSpec.describe "Databases: duplicate database handling" do let(:config) do Jekyll.configuration( "source" => SOURCE_DIR, "destination" => DEST_DIR, "notion" => { "databases" => [ { "id" => "1ae33dd5f331440294806951...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/databases/preserve_existing_files_spec.rb
Ruby
mit
90
main
2,832
# frozen_string_literal: true require "spec_helper" RSpec.describe "Databases: preserve existing files" do let(:config) do Jekyll.configuration( "source" => SOURCE_DIR_2, # Contains existing posts "destination" => DEST_DIR, "notion" => { "databases" => [{ "id" => "1...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/cache/cache_env_var_spec.rb
Ruby
mit
90
main
1,786
# frozen_string_literal: true require "spec_helper" RSpec.describe "Caching: JEKYLL_NOTION_CACHE" do let(:cache_dir) { Dir.mktmpdir("jekyll-cache-") } let(:site) { Jekyll::Site.new(config) } let(:config) do Jekyll.configuration( "source" => SOURCE_DIR, "destination" => DEST_DIR, "noti...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/pages/single_page_spec.rb
Ruby
mit
90
main
1,037
# frozen_string_literal: true require "spec_helper" RSpec.describe "Pages: single page import" do let(:config) do Jekyll.configuration( "source" => SOURCE_DIR, "destination" => DEST_DIR, "notion" => { "pages" => [{ "id" => "9dc17c9c-9d2e-469d-bbf0-f9648f3288d3" }], # Page 1 ...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/pages/preserve_existing_files_spec.rb
Ruby
mit
90
main
2,247
# frozen_string_literal: true require "spec_helper" RSpec.describe "Pages: preserve existing pages" do let(:site) { Jekyll::Site.new(config) } let(:config) do Jekyll.configuration( "source" => SOURCE_DIR_2, # contains a local "Page 1" "destination" => DEST_DIR, "notion" => { ...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/pages/multiple_pages_spec.rb
Ruby
mit
90
main
697
# frozen_string_literal: true require "spec_helper" RSpec.describe "Pages: multiple pages import" do let(:config) do Jekyll.configuration( "source" => SOURCE_DIR, "destination" => DEST_DIR, "notion" => { "pages" => [ { "id" => "9dc17c9c-9d2e-469d-bbf0-f9648f3288d3" ...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/setup/missing_configuration_spec.rb
Ruby
mit
90
main
2,255
# frozen_string_literal: true require "spec_helper" RSpec.describe "Setup: missing notion configuration" do let(:source_dir) { SOURCE_DIR } let(:dest_dir) { DEST_DIR } let(:site) { Jekyll::Site.new(config) } before do allow(Jekyll.logger).to receive(:warn) allow(Jekyll.logger).to receive(:err...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/setup/missing_token_spec.rb
Ruby
mit
90
main
1,234
# frozen_string_literal: true require "spec_helper" RSpec.describe "Setup: missing NOTION_TOKEN" do let(:notion_token) { nil } let(:site) { Jekyll::Site.new(config) } let(:source_dir) { SOURCE_DIR } let(:dest_dir) { DEST_DIR } let(:config) do Jekyll.configuration( "source" => source_dir, ...
github
emoriarty/jekyll-notion
https://github.com/emoriarty/jekyll-notion
spec/integration/setup/deprecated_options_spec.rb
Ruby
mit
90
main
2,499
# frozen_string_literal: true require "spec_helper" RSpec.describe "Setup: deprecated options" do subject(:build!) { site.process } let(:site) { Jekyll::Site.new(config) } before do allow(Jekyll.logger).to receive(:warn) VCR.use_cassette("notion_database") { build! } end context "with fetc...
github
joshmcarthur/vagrant-list
https://github.com/joshmcarthur/vagrant-list
vagrant-list.gemspec
Ruby
mit
90
master
909
# -*- encoding: utf-8 -*- require File.expand_path('../lib/vagrant-list/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Josh McArthur"] gem.email = ["joshua.mcarthur@gmail.com"] gem.description = %q{Extends Vagrant with a 'list' command to list known VirtualBox virtual machine...
github
joshmcarthur/vagrant-list
https://github.com/joshmcarthur/vagrant-list
Gemfile
Ruby
mit
90
master
232
source 'https://rubygems.org' # Specify your gem's dependencies in vagrant-list.gemspec gemspec # Required for running rake spec group :development, :test do gem 'vagrant', :git => 'https://github.com/mitchellh/vagrant.git' end
github
joshmcarthur/vagrant-list
https://github.com/joshmcarthur/vagrant-list
spec/spec_helper.rb
Ruby
mit
90
master
317
require 'rubygems' require 'bundler/setup' require 'vagrant-list' puts <<-WARNING WARNING: Because there is currently no support for mocking or stubbing out calls to VirtualBox, it is required that there be at least one running VM called 'Test' loaded into VirtualBox in order for these tests to pass. WARNING
github
joshmcarthur/vagrant-list
https://github.com/joshmcarthur/vagrant-list
spec/vagrant-list/vm_info_spec.rb
Ruby
mit
90
master
1,282
require 'spec_helper' describe Vagrant::List::VMInfo do let(:uuid) { Vagrant::List::VirtualBox::List.all.first } let(:attributes) { %w( raw uuid name guest_os ) } subject do Vagrant::List::VMInfo.new(uuid) end describe "attributes" do %w( raw uuid name guest_os ).each do |attribute| it { subj...
github
joshmcarthur/vagrant-list
https://github.com/joshmcarthur/vagrant-list
spec/vagrant-list/virtual_box/list_spec.rb
Ruby
mit
90
master
698
require 'spec_helper' describe Vagrant::List::VirtualBox::List do describe ".all" do it "should list VMs" do subject.all.should have_at_least(1).string end it "should gracefully handle command failure" do subject.stub(:errored?).and_return(true) expect { subject.all }.to ...
github
joshmcarthur/vagrant-list
https://github.com/joshmcarthur/vagrant-list
lib/vagrant-list/plugin.rb
Ruby
mit
90
master
895
begin require 'vagrant' rescue LoadError raise 'vagrant-list should be used from within vagrant.' end # Ensure that the gem is not trying to be used from within a vagrant release # that will not have the ability to load the plugin if Vagrant::VERSION < "1.1.0" raise <<-WARN The vagrant-list plugin is only comp...
github
joshmcarthur/vagrant-list
https://github.com/joshmcarthur/vagrant-list
lib/vagrant-list/command.rb
Ruby
mit
90
master
459
module Vagrant module List class Command < Vagrant.plugin("2", :command) def execute @env.ui.info "ALL:" Vagrant::List::VirtualBox::List.all.each do |uuid| @env.ui.info Vagrant::List::VMInfo.new(uuid).inspect end @env.ui.info "RUNNING:" Vagrant::List::Virtu...
github
joshmcarthur/vagrant-list
https://github.com/joshmcarthur/vagrant-list
lib/vagrant-list/vm_info.rb
Ruby
mit
90
master
1,052
require 'vagrant/util' module Vagrant module List class VMInfo include Vagrant::Util attr_accessor :raw attr_accessor :uuid attr_accessor :name attr_accessor :guest_os def initialize(uuid) self.raw = `VBoxManage showvminfo #{uuid}` process! end ...
github
joshmcarthur/vagrant-list
https://github.com/joshmcarthur/vagrant-list
lib/vagrant-list/virtual_box/list.rb
Ruby
mit
90
master
828
module Vagrant module List module VirtualBox module List def self.all raw = `VBoxManage list vms`.split("\n") raise Vagrant::List::CommandError, "VBoxManage list returned non-zero status" if errored? process(raw) end def self.running raw = `V...
github
ayann/active_admin_flat_skin
https://github.com/ayann/active_admin_flat_skin
active_admin_flat_skin.gemspec
Ruby
mit
90
master
984
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'active_admin_flat_skin/version' Gem::Specification.new do |spec| spec.name = "active_admin_flat_skin" spec.version = ActiveAdminFlatSkin::VERSION spec.authors = ["Arman...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
Gemfile
Ruby
mit
90
master
635
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } # Declare your gem's dependencies in activeadmin-chat.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # De...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
activeadmin-chat.gemspec
Ruby
mit
90
master
1,458
# frozen_string_literal: true require_relative 'lib/active_admin/chat/version' # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = 'activeadmin-chat' s.version = ActiveAdmin::Chat::VERSION s.authors = ['Santiago Bartesaghi', 'Federico Aldunate'] s.email ...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
Rakefile
Ruby
mit
90
master
669
begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'ActiveAdmin::Chat' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('README.md...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/spec_helper.rb
Ruby
mit
90
master
4,967
require 'support/test_destination_root' # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loade...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/rails_helper.rb
Ruby
mit
90
master
4,700
# This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('dummy/config/environment', __dir__) # Prevent database truncation if the environment is production abort('The Rails environment is running in production mode!') if Rails...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/unit/active_admin_spec.rb
Ruby
mit
90
master
360
require 'rails_helper' describe ActiveAdmin do context '.register_chat' do it "calls application's #register_page" do subject { ActiveAdmin } expect(ActiveAdmin.application).to receive(:register_page).with( 'My Page', namespace: 'public' ) subject.register_chat 'My Page'...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/unit/active_admin/chat_spec.rb
Ruby
mit
90
master
1,485
require 'rails_helper' describe ActiveAdmin::Chat do context '.conversation_relation_name' do it 'returns the model name' do subject { ActiveAdmin::Chat } expect(subject.conversation_relation_name).to eq('conversation') end end context '.message_relation_name' do it 'returns the model n...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/helpers/active_admin/chat/chat_helper_spec.rb
Ruby
mit
90
master
1,257
require 'rails_helper' describe ActiveAdmin::Chat::ChatHelper, type: :helper do describe '#admin_class' do let!(:admin_user) { create(:admin_user) } let!(:person) { create(:person) } let!(:conversation) { create(:conversation, person: person) } it "returns 'admin' if message sender is an admin" do ...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/generators/install_generator_spec.rb
Ruby
mit
90
master
2,676
require 'spec_helper' require 'generator_spec' # Generators are not automatically loaded by Rails require 'generators/active_admin/chat/install/install_generator' require 'rails/generators/active_record/model/model_generator' describe ActiveAdmin::Chat::Generators::InstallGenerator, type: :generator do destination F...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/features/chat_page_spec.rb
Ruby
mit
90
master
5,338
require 'rails_helper' feature 'Visit the chat page', js: true do given!(:admin) { create(:admin_user) } given(:person1) { create(:person) } given(:person2) { create(:person) } given(:person3) { create(:person) } given(:text1) { build(:text, content: 'Person 1 chat content', sender: person1) } given(:text2...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/features/user_page_spec.rb
Ruby
mit
90
master
1,520
require 'rails_helper' feature 'Visit the users page', js: true do given!(:admin) { create(:admin_user) } given!(:person1) { create(:person) } given!(:person2) { create(:person) } given!(:conversation1) { create(:conversation, person: person1) } scenario 'see the conversation already created and send a mess...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/dummy/config/puma.rb
Ruby
mit
90
master
1,385
# Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum; this matches...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/dummy/config/application.rb
Ruby
mit
90
master
854
require_relative 'boot' require 'rails' # Pick the frameworks you want: require 'active_model/railtie' require 'active_job/railtie' require 'active_record/railtie' require 'action_controller/railtie' require 'action_mailer/railtie' require 'action_view/railtie' require 'action_cable/engine' require 'sprockets/railtie'...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/dummy/config/initializers/active_admin.rb
Ruby
mit
90
master
9,400
ActiveAdmin.setup do |config| # == Site Title # # Set the title that is displayed on the main layout # for each of the active admin pages. # config.site_title = 'Dummy' # Set the link url for the title. For example, to take # users to your main site. Defaults to no link. # # config.site_title_link ...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/dummy/config/initializers/active_admin/chat.rb
Ruby
mit
90
master
303
ActiveAdmin::Chat.setup do |config| # Specify the names of the models required for the chat config.conversation_model_name = 'conversation' config.message_model_name = 'text' config.admin_user_model_name = 'admin_user' config.user_model_name = 'api/person' config.messages_per_page = 25 end
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/dummy/config/environments/production.rb
Ruby
mit
90
master
3,804
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/dummy/config/environments/development.rb
Ruby
mit
90
master
1,938
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web serv...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/dummy/factories/conversation.rb
Ruby
mit
90
master
256
FactoryBot.define do factory :conversation do person trait :with_texts do after(:create) do |instance, evaluator| create_list :text, evaluator.text_count, sender: instance.person, conversation: instance end end end end
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/dummy/db/schema.rb
Ruby
mit
90
master
1,775
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # dat...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/dummy/db/migrate/20181029152853_create_texts.rb
Ruby
mit
90
master
273
class CreateTexts < ActiveRecord::Migration[5.2] def change create_table :texts do |t| t.string :content t.references :sender, polymorphic: true t.integer :conversation_id t.timestamps end add_index :texts, :conversation_id end end
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/dummy/db/migrate/20181029152852_create_conversations.rb
Ruby
mit
90
master
215
class CreateConversations < ActiveRecord::Migration[5.2] def change create_table :conversations do |t| t.integer :person_id t.timestamps end add_index :conversations, :person_id end end
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/channels/active_admin/chat/user_channel_spec.rb
Ruby
mit
90
master
2,353
require 'rails_helper' describe ActiveAdmin::Chat::UserChannel, type: :channel do context 'with non admin users' do let(:person) { create(:person) } before do stub_connection current_user: person end context 'when there is no conversation' do it 'rejects the subscription' do sub...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
spec/channels/active_admin/chat/admin_channel_spec.rb
Ruby
mit
90
master
2,232
require 'rails_helper' describe ActiveAdmin::Chat::AdminChannel, type: :channel do context 'with an admin user' do let(:admin) { create(:admin_user) } before do stub_connection current_user: admin end context 'when there are no conversations' do it "rejects if conversation_id isn't pres...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
lib/generators/active_admin/chat/install/install_generator.rb
Ruby
mit
90
master
3,871
module ActiveAdmin module Chat module Generators class InstallGenerator < Rails::Generators::NamedBase argument :name, default: '' class_option :conversation_model_name, type: :string, default: 'conversation' class_option :message_model_name, type: :string, default: 'message' ...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
lib/active_admin/chat.rb
Ruby
mit
90
master
1,382
require 'active_admin' require 'active_admin/chat/engine' require 'active_admin/chat/extensions' require 'active_admin/chat/extensions/application' require 'active_admin/chat/application' require 'active_admin/chat/extensions/index_table_for' require 'active_admin/chat/message_presenter' require 'webpacker' module Act...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
lib/active_admin/chat/application.rb
Ruby
mit
90
master
935
module ActiveAdmin module Chat class Application attr_accessor :conversation_model_name, :message_model_name, :admin_user_model_name, :user_model_name, :page_name, :namespace, :messages_per_page def initialize @conversation_model_name = 'conversation' @message_mode...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
lib/active_admin/chat/extensions.rb
Ruby
mit
90
master
233
module ActiveAdmin module Chat module Extensions def self.included(base) base.extend ClassMethods end module ClassMethods delegate :register_chat, to: :application end end end end
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
lib/active_admin/chat/message_presenter.rb
Ruby
mit
90
master
503
module ActiveAdmin module Chat class MessagePresenter attr_reader :message def initialize(message) @message = message end def self.all(messages) { messages: messages.map { |m| new(m) } } end def as_json(*) { id: message.id, message...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
lib/active_admin/chat/extensions/application.rb
Ruby
mit
90
master
2,726
module ActiveAdmin module Chat module Extensions module Application def register_chat(name, options = {}, &block) setup_page_configs(name, options[:namespace]) register_page name, options do content do render 'active_admin/chat/chat' end ...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
lib/active_admin/chat/extensions/index_table_for.rb
Ruby
mit
90
master
571
module ActiveAdmin module Chat module Extensions module Views module IndexAsTable module IndexTableFor def send_message_link(resource) text_node link_to 'Send Message', send_message_path(resource.id), ...
github
rootstrap/activeadmin-chat
https://github.com/rootstrap/activeadmin-chat
config/routes.rb
Ruby
mit
90
master
450
Rails.application.routes.draw do if ActiveAdmin::Chat.method_defined?(:page_name) && ActiveAdmin::Chat.page_name namespace ActiveAdmin::Chat.namespace do get "#{ActiveAdmin::Chat.page_name}/:id", to: "#{ActiveAdmin::Chat.page_name}#show" post "#{ActiveAdmin::Chat.user_model_name}/:#{ActiveAdmin::Chat...