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
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
lib/custom_fields/types/many_to_many.rb
Ruby
mit
95
master
2,666
# frozen_string_literal: true module CustomFields module Types module ManyToMany module Field extend ActiveSupport::Concern included do def many_to_many_to_recipe { 'class_name' => class_name, 'inverse_of' => inverse_of, 'order_by' => order_by } end ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
lib/custom_fields/types/json.rb
Ruby
mit
95
master
2,783
# frozen_string_literal: true require 'English' module CustomFields module Types module Json module Field; end module Target extend ActiveSupport::Concern module ClassMethods # Adds a json field # # @param [ Class ] klass The class to modify #...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
lib/custom_fields/types/email.rb
Ruby
mit
95
master
1,953
# frozen_string_literal: true module CustomFields module Types module Email module Field; end module Target extend ActiveSupport::Concern module ClassMethods # Add a string field # # @param [ Class ] klass The class to modify # @param [ Hash ]...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
lib/custom_fields/types/date.rb
Ruby
mit
95
master
3,023
# frozen_string_literal: true module CustomFields module Types module Date module Field; end module Target extend ActiveSupport::Concern module ClassMethods # Adds a date field # # @param [ Class ] klass The class to modify # @param [ Hash ] r...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
lib/custom_fields/types/select.rb
Ruby
mit
95
master
7,441
# frozen_string_literal: true module CustomFields module Types module Select class Option include Mongoid::Document field :name, localize: true field :position, type: ::Integer, default: 0 embedded_in :custom_field, inverse_of: :select_options validates_pres...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
lib/custom_fields/types/string.rb
Ruby
mit
95
master
1,535
# frozen_string_literal: true module CustomFields module Types module String module Field; end module Target extend ActiveSupport::Concern module ClassMethods # Add a string field # # @param [ Class ] klass The class to modify # @param [ Hash ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
lib/custom_fields/types/date_time.rb
Ruby
mit
95
master
3,181
# frozen_string_literal: true module CustomFields module Types module DateTime module Field; end module Target extend ActiveSupport::Concern module ClassMethods # Adds a date_time field # # @param [ Class ] klass The class to modify # @param [...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
lib/custom_fields/types/integer.rb
Ruby
mit
95
master
1,808
# frozen_string_literal: true module CustomFields module Types module Integer module Field; end module Target extend ActiveSupport::Concern module ClassMethods # Add a integer field # # @param [ Class ] klass The class to modify # @param [ Has...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
lib/custom_fields/types/has_many.rb
Ruby
mit
95
master
2,060
# frozen_string_literal: true module CustomFields module Types module HasMany module Field extend ActiveSupport::Concern included do def has_many_to_recipe { 'class_name' => class_name, 'inverse_of' => inverse_of, 'order_by' => order_by } end def ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
lib/custom_fields/types/belongs_to.rb
Ruby
mit
95
master
1,659
# frozen_string_literal: true module CustomFields module Types module BelongsTo module Field extend ActiveSupport::Concern included do def belongs_to_to_recipe { 'class_name' => class_name, 'inverse_of' => inverse_of } end def belongs_to_is_relati...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
lib/custom_fields/types/boolean.rb
Ruby
mit
95
master
1,707
# frozen_string_literal: true module CustomFields module Types module Boolean module Field; end module Target extend ActiveSupport::Concern module ClassMethods # Adds a boolean field. It can not be required. # # @param [ Class ] klass The class to modif...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
lib/custom_fields/types/text.rb
Ruby
mit
95
master
1,672
# frozen_string_literal: true module CustomFields module Types module Text module Field extend ActiveSupport::Concern included do field :text_formatting, default: 'html' end end module Target extend ActiveSupport::Concern module ClassMethods ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/spec_helper.rb
Ruby
mit
95
master
3,334
# frozen_string_literal: true require 'bundler/setup' require 'simplecov' root = File.expand_path '..', __dir__ lib = File.expand_path 'lib', root $LOAD_PATH.unshift lib unless $LOAD_PATH.include? lib require 'custom_fields' # Requires supporting ruby files with custom matchers and macros, etc. in `spec/support` a...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/validations_spec.rb
Ruby
mit
95
master
1,714
# frozen_string_literal: true describe 'CustomFields::Validations' do before(:each) do @blog = create_blog end it 'owns only one validator' do expect(@blog.posts.build.class.validators.size).to eq 3 end it 'does not duplicate the list of validators if adding new fields' do 3.times do |i| ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/field_spec.rb
Ruby
mit
95
master
888
# frozen_string_literal: true describe 'CustomFields::Field' do before(:each) do @blog = create_blog @blog = Blog.find @blog._id end describe 'nested attributes' do it 'renames a field' do @blog.posts_custom_fields_attributes = { '0' => { '_id' => @blog.posts_custom_fields.last._id.to_...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/custom_fields_for_spec.rb
Ruby
mit
95
master
2,635
# frozen_string_literal: true describe 'CustomFields::CustomFieldsFor' do before(:each) do @blog = create_blog end it 'makes sure the field names are correctly set' do @blog.valid? expect(@blog.posts_custom_fields.first.name).to eq 'main_author' end context 'keeps target model_name property' d...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/performance_spec.rb
Ruby
mit
95
master
1,956
# frozen_string_literal: true describe 'CustomFields::Performance' do occurrences = 1000 context 'with custom fields' do before(:each) do @blog = create_blog create_posts @blog, occurrences @blog = Blog.find @blog._id end it "retrieves #{occurrences} posts" do MyBenchmark.me...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/localize_spec.rb
Ruby
mit
95
master
4,358
# frozen_string_literal: true describe 'CustomFields::Localize' do before(:each) do @blog = create_blog @blog = Blog.find @blog._id end it 'mimics the original I18n class' do expect(Mongoid::Fields::I18n.locale).to eq :en Mongoid::Fields::I18n.locale = 'fr' expect(Mongoid::Fields::I18n.loc...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/simple_spec.rb
Ruby
mit
95
master
585
# frozen_string_literal: true describe 'CustomFields::Simple' do let(:blog) { create_blog } let(:a_post) { Post.create title: 'LOL cat', body: 'Lorem ipsum' } describe 'a post' do subject { blog.posts.create title: 'Hello world', body: 'Lorem ipsum' } its(:title) { should eq 'Hello world' } its(:p...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/file_spec.rb
Ruby
mit
95
master
3,564
# frozen_string_literal: true describe CustomFields::Types::File do before(:each) do @blog = create_blog end context 'a new post' do before(:each) do @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...', banner: FixturedFile.open('doc.txt') end it 'does not have 2 image ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/many_to_many_spec.rb
Ruby
mit
95
master
3,709
# frozen_string_literal: true describe CustomFields::Types::ManyToMany do before(:each) do @blog = create_blog @post_1 = @blog.posts.create title: 'Hello world', body: 'Lorem ipsum...', published: true @post_2 = @blog.posts.create title: 'High and Dry', body: 'Lorem ipsum...', published: false ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/text_spec.rb
Ruby
mit
95
master
2,209
# frozen_string_literal: true describe CustomFields::Types::Text do before(:each) do @blog = create_blog end context 'a new post' do before(:each) do @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' end it 'sets the excerpt' do @post.excerpt = 'Well, hello worl...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/string_spec.rb
Ruby
mit
95
master
1,985
# frozen_string_literal: true describe CustomFields::Types::String do let(:blog) { create_blog } context 'a new post' do let(:post) { blog.posts.build(title: 'Hello world', body: 'Lorem ipsum...') } it 'sets the author' do post.author = 'John Doe' expect(post.attributes['author']).to eq 'Joh...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/boolean_spec.rb
Ruby
mit
95
master
1,931
# frozen_string_literal: true describe CustomFields::Types::Boolean do before(:each) do @blog = create_blog end context 'a new post' do before(:each) do @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' end it 'sets the visible flag' do @post.visible = 'true' ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/date_spec.rb
Ruby
mit
95
master
2,198
# frozen_string_literal: true describe CustomFields::Types::Date do before(:each) do @blog = create_blog @date = Date.parse '2007-06-29' end context 'a new post' do before(:each) do @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' end it 'sets the posted_at date'...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/float_spec.rb
Ruby
mit
95
master
1,236
# frozen_string_literal: true describe CustomFields::Types::Float do before(:each) do @blog = create_blog end context 'a new post' do before(:each) do @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' end it 'sets the age' do @post.age = 10.42 expect(@pos...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/has_many_spec.rb
Ruby
mit
95
master
3,819
# frozen_string_literal: true describe CustomFields::Types::HasMany do before(:each) do @blog = create_blog @post_1 = @blog.posts.create title: 'Hello world', body: 'Lorem ipsum...', published: true @post_2 = @blog.posts.create title: 'High and Dry', body: 'Lorem ipsum...', published: false @post_3...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/integer_spec.rb
Ruby
mit
95
master
1,208
# frozen_string_literal: true describe CustomFields::Types::Integer do before(:each) do @blog = create_blog end context 'a new post' do before(:each) do @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' end it 'sets the age' do @post.age = 10 expect(@post...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/belongs_to_spec.rb
Ruby
mit
95
master
1,399
# frozen_string_literal: true describe CustomFields::Types::BelongsTo do before(:each) do @blog = create_blog @author = @blog.people.create name: 'John Doe' @another_author = @blog.people.create name: 'Jane Doe' end context 'a new post' do before(:each) do @post = @blog.p...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/datetime_spec.rb
Ruby
mit
95
master
2,459
# frozen_string_literal: true describe CustomFields::Types::DateTime do before(:each) do Time.zone = 'Paris' Post.any_instance.stubs(:_formatted_date_time_format).returns('%d/%m/%Y %H:%M:%S') @blog = create_blog @datetime = Time.zone.parse '2007-06-29 11:30:40' end context 'a new post' do ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/select_spec.rb
Ruby
mit
95
master
5,701
# frozen_string_literal: true describe CustomFields::Types::Select do before(:each) do @blog = create_blog end context 'a new post' do before(:each) do @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' end it 'sets the category from an existing name' do @post.ma...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/money_spec.rb
Ruby
mit
95
master
1,464
# frozen_string_literal: true describe CustomFields::Types::Money do before(:each) do @blog = create_blog end context 'a new post' do before(:each) do @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' end it 'returns the formatted donation' do @post.donation = '...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/email_spec.rb
Ruby
mit
95
master
1,441
# frozen_string_literal: true describe CustomFields::Types::Email do before(:each) do @blog = create_blog end context 'a new Person' do before(:each) do @person = @blog.people.build name: 'John Doe' end it 'sets the email' do @person.email = 'john@doe.com' expect(@person.attr...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/integration/types/tags_spec.rb
Ruby
mit
95
master
2,430
# frozen_string_literal: true describe CustomFields::Types::Tags do before(:each) do @blog = create_blog end context 'a new post' do before(:each) do @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' end it 'sets the tags' do @post.tags = %w[one two three] ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/support/carrierwave.rb
Ruby
mit
95
master
1,788
# frozen_string_literal: true require 'carrierwave/test/matchers' CarrierWave.configure do |config| if !ENV['GOOGLE_STORAGE_BUCKET'].nil? require 'carrierwave-google-storage' # Google Cloud Storage config.storage = :gcloud config.gcloud_bucket = ENV...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/support/mongoid.rb
Ruby
mit
95
master
565
# frozen_string_literal: true require 'mongoid' Mongoid.load!(File.join(File.dirname(__FILE__), '..', '..', 'config', 'mongoid.yml'), 'test') # Mongoid.logger = Logger.new($stdout) # Mongoid.logger.level = Logger::DEBUG Mongoid.logger.level = Logger::INFO Mongo::Logger.logger.level = Logger::INFO module Mongoid d...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/target_helpers_spec.rb
Ruby
mit
95
master
12,282
# frozen_string_literal: true describe CustomFields::TargetHelpers do before(:each) do @post = build_post_with_rules end context '#grouping fields' do it 'returns empty arrays if no rules' do @post.stubs(:custom_fields_recipe).returns({ 'rules' => [] }) expect(@post.select_custom_fields).to...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/custom_fields_for_spec.rb
Ruby
mit
95
master
425
# frozen_string_literal: true describe 'CustomFieldsFor' do describe 'helpers' do before(:each) do @blog = Blog.new end it 'keeps track of all the associations enhanced by the custom fields' do expect(@blog._custom_fields_for).not_to be_empty end it 'tells if an association is enhan...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/custom_field_spec.rb
Ruby
mit
95
master
1,611
# frozen_string_literal: true describe CustomFields::Field do it 'is initialized' do expect { CustomFields::Field.new }.to_not raise_error end it 'removes dashes in the name if name comes from label' do field = CustomFields::Field.new(label: 'foo-bar') field.send(:set_name) expect(field.name).t...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/password_spec.rb
Ruby
mit
95
master
2,119
# frozen_string_literal: true describe CustomFields::Types::Password do let(:blog) { build_blog } let(:field) { blog.posts_custom_fields.first } let(:post) { blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' } it 'is not considered as a relationship field type' do expect(field.is_relat...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/date_time_spec.rb
Ruby
mit
95
master
3,735
# frozen_string_literal: true describe CustomFields::Types::DateTime do before(:each) do Time.zone = 'Paris' @blog = build_blog @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' @datetime = Time.zone.parse '2010-06-29 11:30:40' end it 'is not considered as a relatio...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/string_spec.rb
Ruby
mit
95
master
1,922
# frozen_string_literal: true describe CustomFields::Types::String do let(:default) { nil } let(:blog) { build_blog } let(:field) { blog.posts_custom_fields.first } let(:post) { blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' } it 'is not considered as a relationship field type' do ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/file_spec.rb
Ruby
mit
95
master
2,229
# frozen_string_literal: true describe CustomFields::Types::File do before(:each) do @blog = build_blog @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' end it 'is not considered as a relationship field type' do expect(@blog.posts_custom_fields.first.is_relationship?).to be fal...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/color_spec.rb
Ruby
mit
95
master
1,840
# frozen_string_literal: true describe CustomFields::Types::Color do let(:default) { nil } let(:blog) { build_blog } let(:field) { blog.posts_custom_fields.first } let(:post) { blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' } it 'is not considered as a relationship field type' do ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/boolean_spec.rb
Ruby
mit
95
master
2,686
# frozen_string_literal: true describe CustomFields::Types::Boolean do let(:default) { nil } let(:blog) { build_blog } let(:field) { blog.posts_custom_fields.first } let(:post) { blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' } it 'is not considered as a relationship field type' do ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/date_spec.rb
Ruby
mit
95
master
3,357
# frozen_string_literal: true describe CustomFields::Types::Date do before(:each) do @blog = build_blog @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' @date = Date.parse '2010-06-29' end it 'is not considered as a relationship field type' do expect(@blog.posts_custom_fiel...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/belongs_to_spec.rb
Ruby
mit
95
master
1,133
# frozen_string_literal: true describe CustomFields::Types::BelongsTo do before(:each) do @blog = build_blog @blog.posts_custom_fields @author = Person.new name: 'John Doe' @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' end it 'is considered as a relationship field typ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/has_many_spec.rb
Ruby
mit
95
master
2,219
# frozen_string_literal: true describe CustomFields::Types::HasMany do before(:each) do @blog = build_blog @post_1 = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' @post_2 = @blog.posts.build title: 'Keep writing', body: 'Lorem ipsum...' @author = @blog.people.build name: 'John Doe'...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/float_spec.rb
Ruby
mit
95
master
1,830
# frozen_string_literal: true describe CustomFields::Types::Float do let(:default) { nil } let(:blog) { build_blog } let(:field) { blog.posts_custom_fields.first } let(:post) { blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' } it 'is not considered as a relationship field type' do ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/json_spec.rb
Ruby
mit
95
master
3,452
# frozen_string_literal: true describe CustomFields::Types::Json do before(:each) do @blog = build_blog @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' end it 'is not considered as a relationship field type' do expect(@blog.posts_custom_fields.first.is_relationship?).to be fal...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/select_spec.rb
Ruby
mit
95
master
3,794
# frozen_string_literal: true describe CustomFields::Types::Select do let(:blog) { build_blog } let(:field) { blog.posts_custom_fields.first } let(:post) { blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' } it 'is not considered as a relationship field type' do expect(field.is_relationship?...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/many_to_many_spec.rb
Ruby
mit
95
master
1,281
# frozen_string_literal: true describe CustomFields::Types::ManyToMany do before(:each) do @blog = build_blog @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' @author_1 = @blog.people.build name: 'John Doe' @author_2 = @blog.people.build name: 'Jane Doe' end it 'is ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/email_spec.rb
Ruby
mit
95
master
1,962
# frozen_string_literal: true describe CustomFields::Types::Email do let(:default) { nil } let(:blog) { build_blog } let(:field) { blog.posts_custom_fields.first } let(:post) { blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' } it 'is not considered as a relationship field type' do ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/money_spec.rb
Ruby
mit
95
master
1,660
# frozen_string_literal: true describe CustomFields::Types::Money do before(:each) do @blog = build_blog @post = @blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' end it 'is not considered as a relationship field type' do expect(@blog.posts_custom_fields.first.is_relationship?).to be fa...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/unit/types/integer_spec.rb
Ruby
mit
95
master
1,814
# frozen_string_literal: true describe CustomFields::Types::Integer do let(:default) { nil } let(:blog) { build_blog } let(:field) { blog.posts_custom_fields.first } let(:post) { blog.posts.build title: 'Hello world', body: 'Lorem ipsum...' } it 'is not considered as a relationship field type' do ...
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/models/blog.rb
Ruby
mit
95
master
213
# frozen_string_literal: true class Blog include Mongoid::Document include CustomFields::Source field :name has_many :people has_many :posts custom_fields_for :people custom_fields_for :posts end
github
locomotivecms/custom_fields
https://github.com/locomotivecms/custom_fields
spec/models/post.rb
Ruby
mit
95
master
265
# frozen_string_literal: true class Post include Mongoid::Document include CustomFields::Target field :title field :body belongs_to :blog, inverse_of: :posts, optional: true, custom_fields_parent_klass: true validates_presence_of :title, :body end
github
jekyll/jekyll-watch
https://github.com/jekyll/jekyll-watch
jekyll-watch.gemspec
Ruby
mit
95
master
1,149
# frozen_string_literal: true require_relative "lib/jekyll-watch/version" Gem::Specification.new do |spec| spec.name = "jekyll-watch" spec.version = Jekyll::Watch::VERSION spec.authors = ["Parker Moore"] spec.email = ["parkrmoore@gmail.com"] spec.summary = "Rebuild your Je...
github
jekyll/jekyll-watch
https://github.com/jekyll/jekyll-watch
spec/watcher_spec.rb
Ruby
mit
95
master
6,513
require "spec_helper" describe(Jekyll::Watcher) do let(:base_opts) do { "source" => source_dir, "destination" => dest_dir, } end let(:options) { base_opts } let(:site) { instance_double(Jekyll::Site) } let(:default_ignored) { [%r!^_config\.yml!, %r!^_site/!, %r!^\.jekyll\-metadat...
github
jekyll/jekyll-watch
https://github.com/jekyll/jekyll-watch
spec/spec_helper.rb
Ruby
mit
95
master
2,935
# frozen_string_literal: true require "jekyll" require File.expand_path("../lib/jekyll-watch.rb", __dir__) TEST_DIR = __dir__ RSpec.configure do |config| # These two settings work together to allow you to limit a spec run # to individual examples or groups you care about by tagging them with # `:focus` metadata...
github
saulabs/reportable
https://github.com/saulabs/reportable
reportable.gemspec
Ruby
mit
95
master
1,184
# -*- encoding: utf-8 -*- pkg_files = [ 'README.md', 'HISTORY.md', 'Rakefile', 'MIT-LICENSE' ] pkg_files += Dir['generators/**/*'] pkg_files += Dir['lib/**/*.rb'] pkg_files += Dir['rails/**/*.rb'] pkg_files += Dir['spec/**/*.{rb,yml,opts}'] Gem::Specification.new do |s| s.name = %q{reportable} s.versi...
github
saulabs/reportable
https://github.com/saulabs/reportable
Gemfile
Ruby
mit
95
master
294
source "http://rubygems.org" gem 'rails', '~> 4.1.0' gem 'protected_attributes' gem 'sqlite3' # gem 'mysql', '>= 2.8.0' gem 'pg' gem 'rspec', '~> 2.8.0' gem 'simplecov' gem 'excellent', '>= 1.5.4' gem 'yard', '>= 0.4.0' gem 'yard-rspec', '>= 0.1.0' gem 'bluecloth', '>= 2.0.5'
github
saulabs/reportable
https://github.com/saulabs/reportable
Rakefile
Ruby
mit
95
master
386
require 'rubygems' require 'bundler' Bundler.setup Bundler.require require "rspec/core/rake_task" desc 'Default: run specs.' task :default => :spec desc 'Run the specs' RSpec::Core::RakeTask.new(:spec) do |spec| end YARD::Rake::YardocTask.new(:doc) do |t| t.files = ['lib/**/*.rb', '-', 'HISTORY.md'] t.optio...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/saulabs/reportable.rb
Ruby
mit
95
master
3,617
require 'saulabs/reportable/report' require 'saulabs/reportable/cumulated_report' require 'saulabs/reportable/railtie' module Saulabs module Reportable # The adapter connects Reportable and Rails. # module RailsAdapter # Extends the {Saulabs::Reportable::ClassMethods#reportable} method into +bas...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/saulabs/reportable/railtie.rb
Ruby
mit
95
master
1,207
require 'saulabs/reportable' require 'saulabs/reportable/report_tag_helper' require 'rails' module Saulabs module Reportable class Railtie < Rails::Railtie GEM_ROOT = File.join(File.dirname(__FILE__), '..', '..', '..') initializer 'saulabs.reportable.initialization' do ActiveSupport.on_lo...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/saulabs/reportable/result_set.rb
Ruby
mit
95
master
1,146
module Saulabs module Reportable # A result set as it is returned by the report methods. # This is basically a subclass of +Array+ that adds two # attributes, +model_class_name+ and +report_name+ that store # the name of the model and the report the result set # was generated from. # cla...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/saulabs/reportable/grouping.rb
Ruby
mit
95
master
5,229
module Saulabs module Reportable # The grouping specifies which records are grouped into one {Saulabs::Reportable::ReportingPeriod}. # class Grouping # Initializes a new grouping. # # @param [Symbol] identifier # the identifier of the grouping (one of +:hour+, +:day+, +:week+ ...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/saulabs/reportable/report.rb
Ruby
mit
95
master
9,066
require 'saulabs/reportable/grouping' require 'saulabs/reportable/report_cache' module Saulabs module Reportable # The Report class that does all the data retrieval and calculations. # class Report # the model the report works on (This is the class you invoke {Saulabs::Reportable::ClassMethods#r...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/saulabs/reportable/report_tag_helper.rb
Ruby
mit
95
master
7,297
require 'saulabs/reportable/config' module Saulabs module Reportable module ReportTagHelper # Renders a sparkline with the given data using the google drawing api. # # @param [Array<Array<DateTime, Float>>] data # an array of report data as returned by {Saulabs::Reportable::Report#ru...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/saulabs/reportable/config.rb
Ruby
mit
95
master
1,187
module Saulabs module Reportable # The Reportable configuration module defines colors, sizes etc. for the different report tag renderers. # module Config mattr_accessor :google_options @@google_options = { :width => 300, :height => 34, :line_color => '0077c...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/saulabs/reportable/cumulated_report.rb
Ruby
mit
95
master
1,371
require 'saulabs/reportable/report' module Saulabs module Reportable # A special report class that cumulates all data (see {Saulabs::Reportable::Report}) # # @example Cumulated reports as opposed to regular reports # # [[<DateTime today>, 1], [<DateTime yesterday>, 2], [<DateTime two days ago>...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/saulabs/reportable/reporting_period.rb
Ruby
mit
95
master
6,711
module Saulabs module Reportable # A reporting period is a specific hour or a specific day etc. depending on the used {Saulabs::Reportable::Grouping}. # class ReportingPeriod # The actual +DateTime the reporting period represents # attr_reader :date_time # The {Saulabs::Reporta...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/saulabs/reportable/report_cache.rb
Ruby
mit
95
master
8,960
require 'saulabs/reportable/reporting_period' require 'saulabs/reportable/result_set' require 'active_record' module Saulabs module Reportable # The +ReportCache+ class is a regular +ActiveRecord+ model and represents cached results for single {Saulabs::Reportable::ReportingPeriod}s. # +ReportCache+ instan...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/generators/reportable_raphael_assets/reportable_raphael_assets_generator.rb
Ruby
mit
95
master
717
class ReportableRaphaelAssetsGenerator < Rails::Generators::Base include Rails::Generators::Actions source_root File.expand_path('../templates/', __FILE__) def create_raphael_file empty_directory('public/javascripts') copy_file( File.join(File.dirname(__FILE__), 'templates', 'raphael.min.js'), ...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/generators/reportable_jquery_flot_assets/reportable_jquery_flot_assets_generator.rb
Ruby
mit
95
master
597
class ReportableJqueryFlotAssetsGenerator < Rails::Generators::Base include Rails::Generators::Actions source_root File.expand_path('../templates/', __FILE__) def create_jquery_flot_file empty_directory('public/javascripts') copy_file( File.join(File.dirname(__FILE__), 'templates', 'jquery.flot.m...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/generators/reportable_migration/reportable_migration_generator.rb
Ruby
mit
95
master
500
class ReportableMigrationGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path('../templates/', __FILE__) def create_reportable_migration migration_template('migration.rb', 'db/migrate/create_reportable_cache.rb') end def self.next_migration_number(dirna...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/generators/reportable_migration/templates/migration.rb
Ruby
mit
95
master
1,268
class CreateReportableCache < ActiveRecord::Migration def self.up create_table :reportable_cache, :force => true do |t| t.string :model_class_name, :null => false, :limit => 100 t.string :report_name, :null => false, :limit => 100 t.string :grouping, :null => false, :li...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/generators/reportable_model_name_migration/reportable_model_name_migration_generator.rb
Ruby
mit
95
master
524
class ReportableModelNameMigrationGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) include Rails::Generators::Migration def create_reportable_model_name_migration migration_template('migration.rb', 'db/migrate/reportable_rename_model_name.rb') end def self.next...
github
saulabs/reportable
https://github.com/saulabs/reportable
lib/generators/reportable_model_name_migration/templates/migration.rb
Ruby
mit
95
master
243
class ReportableRenameModelName < ActiveRecord::Migration def self.up rename_column :reportable_cache, :model_name, :model_class_name end def self.down rename_column :reportable_cache, :model_class_name, :model_name end end
github
saulabs/reportable
https://github.com/saulabs/reportable
spec/spec_helper.rb
Ruby
mit
95
master
1,421
ENV['RAILS_ENV'] = 'test' require 'rubygems' require 'bundler/setup' require 'active_record' require 'active_record/version' require 'active_support' begin require 'ruby-debug' # Debugger.start # Debugger.settings[:autoeval] = true if Debugger.respond_to?(:settings) rescue LoadError # ruby-debug wasn't availa...
github
saulabs/reportable
https://github.com/saulabs/reportable
spec/classes/report_spec.rb
Ruby
mit
95
master
29,873
require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))),'spec_helper') describe Saulabs::Reportable::Report do before do @report = Saulabs::Reportable::Report.new(User, :registrations) @now = Time.now DateTime.stub!(:now).and_return(@now) end describe '#options' do it 'shou...
github
saulabs/reportable
https://github.com/saulabs/reportable
spec/classes/report_cache_spec.rb
Ruby
mit
95
master
14,441
require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))),'spec_helper') describe Saulabs::Reportable::ReportCache do before do @report = Saulabs::Reportable::Report.new(User, :registrations, :limit => 10) end describe 'validations' do before do @report_cache = Saulabs::Reportable...
github
saulabs/reportable
https://github.com/saulabs/reportable
spec/classes/grouping_spec.rb
Ruby
mit
95
master
7,606
require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))),'spec_helper') describe Saulabs::Reportable::Grouping do describe '#new' do it 'should raise an error if an unsupported grouping is specified' do lambda { Saulabs::Reportable::Grouping.new(:unsupported) }.should raise_error(Argument...
github
saulabs/reportable
https://github.com/saulabs/reportable
spec/classes/reporting_period_spec.rb
Ruby
mit
95
master
15,815
require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))),'spec_helper') describe Saulabs::Reportable::ReportingPeriod do describe '#date_time' do it 'should return the date and time with minutes = seconds = 0 for grouping :hour' do date_time = DateTime.now reporting_period = Saulabs...
github
saulabs/reportable
https://github.com/saulabs/reportable
spec/classes/cumulated_report_spec.rb
Ruby
mit
95
master
6,135
require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))),'spec_helper') describe Saulabs::Reportable::CumulatedReport do before do @report = Saulabs::Reportable::CumulatedReport.new(User, :cumulated_registrations) end describe '#run' do it 'should cumulate the data' do @report.sh...
github
saulabs/reportable
https://github.com/saulabs/reportable
spec/other/report_tag_helper_spec.rb
Ruby
mit
95
master
5,195
require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))),'spec_helper') require 'reportable/report_tag_helper' describe Saulabs::Reportable::ReportTagHelper do before do @helper = TestHelper.new end describe '#raphael_report_tag' do data_set = Saulabs::Reportable::ResultSet.new([[Date...
github
saulabs/reportable
https://github.com/saulabs/reportable
spec/other/report_method_spec.rb
Ruby
mit
95
master
1,999
require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))),'spec_helper') describe Saulabs::Reportable do ActiveRecord::Base.class_eval do include Saulabs::Reportable::RailsAdapter end class User < ActiveRecord::Base reportable :registrations, :limit => 10 end class SpecialUser <...
github
saulabs/reportable
https://github.com/saulabs/reportable
spec/db/schema.rb
Ruby
mit
95
master
1,239
ActiveRecord::Schema.define(:version => 1) do create_table :users, :force => true do |t| t.string :login, :null => false t.integer :profile_visits, :null => false, :default => 0 t.string :type, :null => false, :default => 'User' t.string :sub_type t.timestamps end crea...
github
ericqweinstein/ruumba
https://github.com/ericqweinstein/ruumba
Guardfile
Ruby
mit
95
master
307
# @author Eric Weinstein <eric.q.weinstein@gmail.com> # More info at https://github.com/guard/guard#readme guard :rspec, cmd: 'rspec --color --format d' do watch %r{^spec/.+_spec\.rb$} watch(%r{^lib/ruumba/(.+)\.rb$}) { |m| "spec/ruumba/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { 'spec' } end
github
ericqweinstein/ruumba
https://github.com/ericqweinstein/ruumba
Rakefile
Ruby
mit
95
master
635
#!/usr/bin/env rake require 'rspec/core/rake_task' require 'rubocop/rake_task' require 'yard' task default: 'test:all' desc 'Run IRB with the gem environment loaded' task :console do puts '[+] Loading development console...' system('irb -r ./lib/ruumba.rb') end desc 'Run tests' task :spec do RSpec::Core::Rake...
github
ericqweinstein/ruumba
https://github.com/ericqweinstein/ruumba
Gemfile
Ruby
mit
95
master
303
source 'https://rubygems.org' ruby '~> 2.4' gemspec group :development, :test do gem 'guard', '~> 2.16.2' gem 'guard-rspec', '~> 4.7.3' gem 'rake', '~> 13.0.1' gem 'rspec', '~> 3.9.0' gem 'rubocop' gem 'simplecov', require: false gem 'yard', '>= 0.9.20' end
github
ericqweinstein/ruumba
https://github.com/ericqweinstein/ruumba
ruumba.gemspec
Ruby
mit
95
master
787
$LOAD_PATH.push File.expand_path('../lib', __FILE__) require 'ruumba/version' Gem::Specification.new do |g| g.name = 'ruumba' g.version = ::Ruumba::Version::STRING g.authors = ['Eric Weinstein', 'Jan Biniok', 'Yvan Barthélemy', 'Andrew Clemons'] g.date = '2021-01-15' g.descript...
github
ericqweinstein/ruumba
https://github.com/ericqweinstein/ruumba
spec/spec_helper.rb
Ruby
mit
95
master
442
# @author Eric Weinstein <eric.q.weinstein@gmail.com> # Test coverage report require 'simplecov' SimpleCov.start # Don't include spec files in the coverage report SimpleCov.add_filter '/spec/' # Require all lib/ files Dir["#{File.dirname(__FILE__)}/../lib/**/*.rb"].sort.each { |f| require f } RSpec.configure do |c|...
github
ericqweinstein/ruumba
https://github.com/ericqweinstein/ruumba
spec/ruumba/analyzer_spec.rb
Ruby
mit
95
master
5,643
# @author Eric Weinstein <eric.q.weinstein@gmail.com> require 'spec_helper' describe Ruumba::Analyzer do subject(:analysis) { analyzer.run(file_list) } let(:analyzer) { described_class.new(options) } let(:current_directory) { Pathname.new(ENV['PWD']) } let(:rubocop_runner) { instance_double(Ruumba::RubocopRun...
github
ericqweinstein/ruumba
https://github.com/ericqweinstein/ruumba
spec/ruumba/rubocop_runner_spec.rb
Ruby
mit
95
master
2,377
# @author Eric Weinstein <eric.q.weinstein@gmail.com> require 'spec_helper' describe Ruumba::RubocopRunner do let(:runner) { described_class.new(arguments, current_directory, target, stdin, rb_extension_enabled) } let(:rb_extension_enabled) { false } let(:target) { Pathname.new(Dir.mktmpdir) } let(:arguments)...
github
ericqweinstein/ruumba
https://github.com/ericqweinstein/ruumba
spec/ruumba/rake_task_spec.rb
Ruby
mit
95
master
433
# @author Eric Weinstein <eric.q.weinstein@gmail.com> require 'spec_helper' describe Ruumba::RakeTask do describe '#initialize' do it 'sets the name of the task when provided' do ruumba = Ruumba::RakeTask.new(:foo) expect(ruumba.name).to eq :foo end it 'defaults the task name to :ruumba whe...
github
ericqweinstein/ruumba
https://github.com/ericqweinstein/ruumba
spec/ruumba/iterators_spec.rb
Ruby
mit
95
master
2,389
# @author Eric Weinstein <eric.q.weinstein@gmail.com> # @author Andrew Clemons <andrew.clemons@gmail.com> require 'spec_helper' describe Ruumba::Iterators::StdinIterator do let(:iterator) { described_class.new(filename) } let(:files) { iterator.to_a } let(:filename) { 'blah.erb' } let(:contents) { 'file conte...
github
ericqweinstein/ruumba
https://github.com/ericqweinstein/ruumba
spec/ruumba/correctors_spec.rb
Ruby
mit
95
master
5,825
# @author Andrew Clemons <andrew.clemons@gmail.com> require 'spec_helper' require 'tempfile' describe Ruumba::Correctors::Replacer do class TestReplacer include Ruumba::Correctors::Replacer attr_accessor :digestor, :parser def initialize(digestor, parser) @digestor = digestor @parser = par...
github
ericqweinstein/ruumba
https://github.com/ericqweinstein/ruumba
spec/ruumba/parser_spec.rb
Ruby
mit
95
master
3,045
# @author Eric Weinstein <eric.q.weinstein@gmail.com> require 'spec_helper' describe Ruumba::Parser do let(:parser) { described_class.new } describe '#extract' do it 'extracts one line of Ruby code from an ERB template' do erb = "<%= puts 'Hello, world!' %>" expect(parser.extract(erb)).to eq(" ...
github
ericqweinstein/ruumba
https://github.com/ericqweinstein/ruumba
lib/ruumba/analyzer.rb
Ruby
mit
95
master
3,726
# @author Eric Weinstein <eric.q.weinstein@gmail.com> require 'securerandom' require 'digest' require 'pathname' require 'tmpdir' require 'open3' require 'English' require 'ruumba/iterators' require 'ruumba/correctors' require 'ruumba/parser' require 'ruumba/rubocop_runner' # Ruumba: RuboCop's sidekick. module Ruumb...