repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/apps/kitchen_sink/app/main/models/user.rb | spec/apps/kitchen_sink/app/main/models/user.rb | class User < Volt::User
# login_field is set to :email by default and can be changed to :username
# in config/app.rb
field login_field
field :name
validate login_field, unique: true, length: 8
validate :email, email: true
unless RUBY_PLATFORM == "opal"
Volt.current_app.on("user_connect") do |user_id... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/apps/kitchen_sink/app/main/config/routes.rb | spec/apps/kitchen_sink/app/main/config/routes.rb | # See https://github.com/voltrb/volt#routes for more info on routes
client '/bindings/{{ route_test }}', action: 'bindings'
client '/bindings', action: 'bindings'
client '/form', action: 'form'
client '/store', action: 'store_demo'
client '/cookie_test', action: 'cookie_test'
client '/flash', action: 'flash'
client '/... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/apps/kitchen_sink/app/main/config/dependencies.rb | spec/apps/kitchen_sink/app/main/config/dependencies.rb | # Specify which components you wish to include when
# the "home" component loads.
# bootstrap css framework
component 'bootstrap'
# a default theme for the bootstrap framework
component 'bootstrap_jumbotron_theme'
# For testing user
component 'fields'
# For testing
component 'user_templates'
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/apps/kitchen_sink/app/main/config/initializers/sample_model_extend.rb | spec/apps/kitchen_sink/app/main/config/initializers/sample_model_extend.rb | module Volt
class Model
def self.acts_awesome
true
end
end
end | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/apps/kitchen_sink/config/app.rb | spec/apps/kitchen_sink/config/app.rb | Volt.setup do |config|
config.app_secret = 'vFYUzMiPIdMw1Iox0ggDpBYorLm_d55YtRPc0eGrdCpoN4h9E5FcWySIT_D8JIEOllU'
end
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/apps/file_loading/app/missing_deps/config/dependencies.rb | spec/apps/file_loading/app/missing_deps/config/dependencies.rb | component 'a-gem-that-isnt-in-the-gemfile'
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/apps/file_loading/app/main/config/dependencies.rb | spec/apps/file_loading/app/main/config/dependencies.rb | component 'shared'
component 'slideshow'
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/apps/file_loading/app/disable_auto/config/dependencies.rb | spec/apps/file_loading/app/disable_auto/config/dependencies.rb | disable_auto_import
javascript_file '/app/disable_auto/assets/js/test1.js'
css_file 'test1' | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/apps/file_loading/app/shared/config/dependencies.rb | spec/apps/file_loading/app/shared/config/dependencies.rb | component 'bootstrap' | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/helpers/volt_time_spec.rb | spec/helpers/volt_time_spec.rb | require 'spec_helper'
require 'volt/helpers/time'
describe VoltTime do
let(:vt0) { VoltTime.at(0) }
let(:vt120) { VoltTime.at(120) }
let(:rt0) { Time.at(0) }
let(:local_beginning) do
if rt0.utc_offset >= 0
Time.new(1970, 1, 1)
else
Time.new(1969, 12, 31)
end
end ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/helpers/duration_spec.rb | spec/helpers/duration_spec.rb | require 'spec_helper'
require 'volt/helpers/time'
describe Numeric do
describe "#seconds" do
it "returns 1 second for 1 second" do
expect(1.second).to eq(1)
end
it "returns 1 minute for 60 seconds" do
expect(60.seconds).to eq(1.minute)
end
end
describe "#minutes" do
it "re... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/helpers/distance_spec.rb | spec/helpers/distance_spec.rb | require 'spec_helper'
require 'volt/helpers/time'
describe Volt::Duration do
it 'should return a sentence describing the time' do
dist = 1.hour + 2.days + 1.month + 305.seconds + 1.5.days
expect(dist.duration_in_words(nil, :seconds)).to eq('1 month, 3 days, 13 hours, 5 minutes, and 5 seconds')
end
it '... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/controllers/http_controller_spec.rb | spec/controllers/http_controller_spec.rb | require 'spec_helper'
if RUBY_PLATFORM != 'opal'
require 'volt/controllers/http_controller'
require 'volt/server/rack/http_request'
require 'volt/server/rack/http_resource'
describe Volt::HttpController do
class TestHttpController < Volt::HttpController
attr_reader :ran_action1
attr_reader :ac... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/controllers/reactive_accessors_spec.rb | spec/controllers/reactive_accessors_spec.rb | require 'spec_helper'
require 'volt/reactive/reactive_accessors'
class TestReactiveAccessors
include Volt::ReactiveAccessors
reactive_accessor :_name
end
describe Volt::ReactiveAccessors do
it 'should assign a reactive value' do
inst = TestReactiveAccessors.new
inst._name = 'Ryan'
expect(inst._nam... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/controllers/model_controller_spec.rb | spec/controllers/model_controller_spec.rb | require 'spec_helper'
if RUBY_PLATFORM != 'opal'
describe Volt::ModelController do
it 'should accept a promise as a model and resolve it' do
controller = Volt::ModelController.new(volt_app)
promise = Promise.new
controller.model = promise
expect(controller.model).to eq(nil)
prom... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/buffer_spec.rb | spec/models/buffer_spec.rb | require 'spec_helper'
class ::TestSaveFailure < Volt::Model
validate :name, length: 5
end
class ::TestChangedAttribute < Volt::Model
before_save :change_attributes
def change_attributes
set('one', 1)
set('two', 2)
end
end
describe Volt::Buffer do
it 'should let you pass a block that evaluates to t... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/model_state_spec.rb | spec/models/model_state_spec.rb | # Models automatically unload if no dependencies are listening and they have not been .keep (kept)
if RUBY_PLATFORM != 'opal'
require 'spec_helper'
describe Volt::Model do
it 'should stay loaded while a computaiton is watching some data' do
expect(store._items!.loaded_state).to eq(:not_loaded)
co... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/array_model_spec.rb | spec/models/array_model_spec.rb | require 'spec_helper'
# TODO: ArrayModel and Model specs are mixed in model_spec atm. Need to move
# ArrayModel specs here.
describe Volt::ArrayModel do
unless RUBY_PLATFORM == 'opal'
it 'should return a Promise for empty? on store' do
expect(store._posts.empty?.class).to eq(Promise)
end
end
it '... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/validations_spec.rb | spec/models/validations_spec.rb | require 'spec_helper'
describe Volt::Model do
let(:model) { test_model_class.new }
let(:test_model_class) do
Class.new(Volt::Model) do
validate :count, numericality: { min: 5, max: 10 }
validate :description, length: { message: 'needs to be longer',
length: 5... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/permissions_spec.rb | spec/models/permissions_spec.rb | require 'spec_helper'
class TestUserTodo < Volt::Model
own_by_user
permissions(:update) do
deny :user_id
end
end
class TestUserTodoWithCrudStates < Volt::Model
permissions(:create, :update) do |state|
# Name is set on create, then can not be changed
deny unless state == :create
end
end
class :... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/model_spec.rb | spec/models/model_spec.rb | require 'spec_helper'
class TestItem < Volt::Model
end
class Item < Volt::Model
end
class Items < Volt::ArrayModel
end
class SubItem < Item
end
class TestAssignsMethod < Volt::Model
def name=(val)
self._name = val
end
end
describe Volt::Model do
it 'delegates unary operator to its attributes' do
mod... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/url_spec.rb | spec/models/url_spec.rb | require 'spec_helper'
require 'volt/models/url'
describe Volt::URL do
let(:uri) { 'http://voltframework.com:8888/path/1?query=val#fragment' }
let(:fake_location) do
double(
'Volt::Location',
host: 'voltframework.com',
protocol: 'http:',
scheme: 'http'
)
end
before do
allow... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/associations_spec.rb | spec/models/associations_spec.rb | require 'spec_helper'
class ::Person < Volt::Model
has_many :addresses
end
class ::Address < Volt::Model
belongs_to :person
has_one :zip_info
end
class ::AddressBelongToOption < Volt::Model
belongs_to :someone, collection: :person, foreign_key: :id, local_key: :some_weird_id
end
class ::ZipInfo < Volt::Mode... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/dirty_spec.rb | spec/models/dirty_spec.rb | require 'spec_helper'
describe 'Volt::Dirty' do
let(:model) do
model = Volt::Model.new
# Run changed on the model will revert changes after each sync
allow(model).to receive(:run_changed)
model
end
it 'should track changed attributes' do
model._name = 'Bob'
expect(model.name_was).to eq... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/user_validation_spec.rb | spec/models/user_validation_spec.rb | require 'spec_helper'
class TestUserTodo < Volt::Model
own_by_user
permissions(:update) do
deny :user_id
end
end
describe Volt::UserValidatorHelpers do
context 'with user' do
before do
allow(Volt).to receive(:current_user_id) { 294 }
end
it 'should assign user_id when owning by a user'... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/user_spec.rb | spec/models/user_spec.rb | require 'spec_helper'
require 'volt/models/user'
class FakeConfig
def public
self
end
def auth
self
end
def use_username
true
end
end
describe Volt::User do
describe '.login_field' do
subject { Volt::User.login_field }
describe 'when use_username is set to true' do
before do... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/field_helpers_spec.rb | spec/models/field_helpers_spec.rb | require 'spec_helper'
require 'volt/models'
class ExampleModelWithField < Volt::Model
field :name
field :value, Numeric
end
class ExampleModelWithField2 < ExampleModelWithField
end
describe 'field helpers' do
let(:model) { ExampleModelWithField.new }
it 'should allow a user to setup a field that can be writt... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/helpers/model_spec.rb | spec/models/helpers/model_spec.rb | require 'spec_helper'
describe Volt::Models::Helpers::Model do
describe "saved_state" do
it 'should start not_saved for a buffer' do
item = the_page._items.buffer
expect(item.saved_state).to eq(:not_saved)
end
it 'should move to saved when the buffer is saved' do
item = the_page._items... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/helpers/base_spec.rb | spec/models/helpers/base_spec.rb | require 'spec_helper'
describe Volt::Models::Helpers::Base do
# it 'should have a root method on models that returns the root collection' do
# model = store._posts.create
# expect(model.root).to eq(store)
# end
end | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/validators/block_validations_spec.rb | spec/models/validators/block_validations_spec.rb | require 'spec_helper'
unless RUBY_PLATFORM == 'opal'
describe 'validations block' do
let(:model) { test_model_class.new }
let(:test_model_class) do
Class.new(Volt::Model) do
validations do
if _is_ready == true
validate :name, length: 5
end
end
end
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/validators/unique_validator_spec.rb | spec/models/validators/unique_validator_spec.rb | require 'spec_helper'
unless RUBY_PLATFORM == 'opal'
class Fridge < Volt::Model
validate :name, unique: true
end
describe 'unique spec' do
it 'should reject save if there are records with existing attributes already' do
store._fridges << { name: 'swift' }
fridge = store._fridges.buffer name:... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/validators/inclusion_validator_spec.rb | spec/models/validators/inclusion_validator_spec.rb | require 'spec_helper'
describe Volt::InclusionValidator do
subject { Volt::InclusionValidator.validate(*use_params) }
let(:use_params) { [model, field_name, options] }
let(:model) { Volt::Model.new name: name }
let(:field_name) { :name }
let(:name) { 'John' }
describe '.validate' do
describe 'when op... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/validators/length_validator_spec.rb | spec/models/validators/length_validator_spec.rb | require 'spec_helper'
describe Volt::LengthValidator do
subject { Volt::LengthValidator.validate(*use_params) }
let(:use_params) { [model, field_name, options] }
let(:model) { Volt::Model.new name: name }
let(:field_name) { :name }
let(:name) { 'John Doe' }
describe '.validate' do
describe 'when opti... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/validators/email_validator_spec.rb | spec/models/validators/email_validator_spec.rb | require 'spec_helper'
describe Volt::Model do
let(:model) { test_model_class.new }
let(:test_model_class) do
Class.new(Volt::Model) do
validate :count, numericality: { min: 5, max: 10 }
validate :description, length: { message: 'needs to be longer',
length: 5... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/validators/phone_number_validator_spec.rb | spec/models/validators/phone_number_validator_spec.rb | require 'spec_helper'
require 'models/validators/shared_examples_for_validators'
describe Volt::PhoneNumberValidator do
subject { described_class.new(*init_params) }
let(:init_params) { [model, field_name] }
let(:model) { Volt::Model.new phone_number: phone_number }
let(:field_name) { :phone_number }
let(:o... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/validators/type_validator_spec.rb | spec/models/validators/type_validator_spec.rb | require 'spec_helper'
describe Volt::TypeValidator do
subject { Volt::TypeValidator.validate(*use_params) }
let(:use_params) { [model, field_name, options] }
let(:model) { Volt::Model.new count: count }
let(:field_name) { :count }
let(:name) { 'John Doe' }
describe '.validate' do
describe 'when optio... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/validators/shared_examples_for_validators.rb | spec/models/validators/shared_examples_for_validators.rb | require 'spec_helper'
shared_examples_for 'a format validator' do
let(:regex) { /^valid/ }
let(:proc_regex) { /^valid/ }
let(:test_proc) { ->(content) { proc_regex.match content } }
let(:proc_opts) { { with: test_proc, message: proc_message } }
let(:regex_opts) { { with: regex, message: regex_message } }
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/validators/format_validator_spec.rb | spec/models/validators/format_validator_spec.rb | require 'spec_helper'
require 'models/validators/shared_examples_for_validators'
# test fake used for edge cases where default_options are not Hash types.
# Feel free to append stub methods to this class as needed for testing.
class SpecValidator < Volt::FormatValidator
def default_options
"No hash here, no sir!... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/persistors/page_spec.rb | spec/models/persistors/page_spec.rb | require 'spec_helper'
module Volt
module Persistors
describe Page do
describe '#where' do
it 'searches for records in the page collection with the given values' do
juan = Volt::Model.new(name: 'Juan', city: 'Quito', age: 13)
pedro = Volt::Model.new(name: 'Pedro', city: 'Quito',... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/persistors/flash_spec.rb | spec/models/persistors/flash_spec.rb | require 'spec_helper'
module Volt
module Persistors
describe Flash do
let(:fake_parent) { double('Parent', delete: true) }
let(:fake_passed_model) { double }
let(:fake_model) do
double(
'Model',
size: 1,
parent: fake_parent,
path: '12',
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/persistors/store_spec.rb | spec/models/persistors/store_spec.rb | require 'spec_helper'
require 'volt/models'
describe Volt::Persistors::Store do
it 'should tell the persistor when the model has changed' do
persistor = double('volt/persistor')
persistor_instance = double('volt/persistor instance')
expect(persistor_instance).to receive(:loaded)
expect(persistor).to ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/models/persistors/params_spec.rb | spec/models/persistors/params_spec.rb | require 'spec_helper'
require 'volt/models'
describe Volt::Persistors::Params do
it 'should stay as params classes when used' do
a = Volt::Model.new({}, persistor: Volt::Persistors::Params)
# expect(a._test!.class).to eq(Volt::Model)
#
# expect(a._test!._cool!.persistor.class).to eq(Volt::Persistors:... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/utils/parsing_spec.rb | spec/utils/parsing_spec.rb | require 'spec_helper'
describe Volt::Parsing do
subject { Volt::Parsing }
context 'surrounding encoding/decoding' do
it 'does not mangle characters' do
raw = ' !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~''"'
encoded = subject.encodeURI raw
decoded = subject.decodeURI encoded
expect(decoded).to ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/utils/task_argument_filtererer_spec.rb | spec/utils/task_argument_filtererer_spec.rb | require 'spec_helper'
if RUBY_PLATFORM != 'opal'
describe TaskArgumentFilterer do
it 'should filter arguments' do
filtered_args = TaskArgumentFilterer.new(login: 'jim@jim.com', password: 'some password no one should see').run
expect(filtered_args).to eq(login: 'jim@jim.com', password: '[FILTERED]')
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/utils/data_transformer_spec.rb | spec/utils/data_transformer_spec.rb | require 'spec_helper'
require 'volt/utils/data_transformer'
describe Volt::DataTransformer do
it 'should transform values' do
data = {
name: 'Bob',
stuff: [
{key: /regex/}
],
other: /another regex/,
/some reg/ => 'value'
}
transformed = {
:name=>"Bob",
:... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/utils/ejson_spec.rb | spec/utils/ejson_spec.rb | require 'spec_helper'
require 'volt/helpers/time'
describe Volt::EJSON, '.parse' do
subject { Volt::EJSON }
let(:epoch) { 135820576553 }
let(:ruby_epoch) { epoch / 1000.0 }
context 'safe escaping' do
it 'does not parse date objects with invalid values' do
parsed = subject.parse '{"a" : {"$escape" : ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/utils/ejson_volt_time_spec.rb | spec/utils/ejson_volt_time_spec.rb | require 'spec_helper'
require 'volt/helpers/time'
describe Volt::EJSON, '.parse' do
subject { Volt::EJSON }
let(:epoch) { 135820576553 }
let(:ruby_epoch) { epoch / 1000.0 }
context 'parsing EJSON fields' do
context 'VoltTime' do
it 'parses proper $date EJSON fields to VoltTime' do
parsed = s... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/utils/promise_extensions_spec.rb | spec/utils/promise_extensions_spec.rb | require 'spec_helper'
def count_occurences(str, find)
count = 0
loop do
index = str.index(find)
break unless index
count += 1
str = str[index+1..-1]
end
count
end
describe Promise do
it 'should allow you to call methods that will be called on the resolved value and re... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/utils/generic_pool_spec.rb | spec/utils/generic_pool_spec.rb | require 'volt/utils/generic_pool'
class PoolTest < Volt::GenericPool
def create(collection, query, other = nil)
Object.new
end
end
describe Volt::GenericPool do
before do
@pool_test = PoolTest.new
end
it 'should insert nested for fast lookup at a path' do
item1 = @pool_test.lookup('_items', 'on... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/utils/lifecycle_callbacks_spec.rb | spec/utils/lifecycle_callbacks_spec.rb | require 'spec_helper'
require 'volt/controllers/model_controller'
class BaseTestActions
include Volt::LifecycleCallbacks
setup_action_helpers_in_class(:before_action, :after_action)
end
class TestActionsBlocks < BaseTestActions
before_action do
@ran_before1 = true
end
before_action do
@ran_before2... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/utils/generic_counting_pool_spec.rb | spec/utils/generic_counting_pool_spec.rb | require 'volt/utils/generic_counting_pool'
class CountingPoolTest < Volt::GenericCountingPool
def create(id, name = nil)
Object.new
end
end
describe Volt::GenericCountingPool do
before do
@count_pool = CountingPoolTest.new
end
it 'should lookup and retrieve' do
item1 = @count_pool.find('one')
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/reactive/dependency_spec.rb | spec/reactive/dependency_spec.rb | require 'spec_helper'
describe Volt::Dependency do
it 'should trigger on_dep and on_stop_dep when setup and torn down' do
dep_count = 0
stop_dep_count = 0
dep = Volt::Dependency.new(-> { dep_count += 1 }, -> { stop_dep_count += 1 })
expect(dep_count).to eq(0)
expect(stop_dep_count).to eq(0)
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/reactive/computation_spec.rb | spec/reactive/computation_spec.rb | require 'spec_helper'
describe Volt::Computation do
it 'should trigger again when a dependent changes' do
a = Volt::ReactiveHash.new
values = []
-> { values << a[0] }.watch!
expect(values).to eq([nil])
a[0] = 'one'
Volt::Computation.flush!
expect(values).to eq([nil, 'one'])
a[0] ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/reactive/class_eventable_spec.rb | spec/reactive/class_eventable_spec.rb | require 'spec_helper'
class TestClassEventable
include Volt::ClassEventable
attr_reader :run_count
def initialize
@run_count = 0
end
on(:works) do
ran_works
end
def ran_works
@run_count += 1
end
def trigger_works_event!
trigger!(:works, 20)
end
end
describe Volt::ClassEventabl... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/reactive/reactive_hash_spec.rb | spec/reactive/reactive_hash_spec.rb | require 'spec_helper'
describe Volt::ReactiveHash do
it 'should clear' do
a = Volt::ReactiveHash.new
a[:name] = 'Bob'
expect(a[:name]).to eq('Bob')
a.clear
expect(a[:name]).to eq(nil)
end
it 'should return to_json' do
a = Volt::ReactiveHash.new({name: 'bob'})
expect(a.to_json).to eq... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/reactive/reactive_array_spec.rb | spec/reactive/reactive_array_spec.rb | require 'spec_helper'
require 'volt/reactive/reactive_array'
describe Volt::ReactiveArray do
describe 'cells' do
it 'should track dependencies for cells' do
a = Volt::ReactiveArray.new
count = 0
values = []
-> { values << a[0]; count += 1 }.watch!
a[0] = 5
Volt::Computation... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/reactive/eventable_spec.rb | spec/reactive/eventable_spec.rb | require 'spec_helper'
require 'volt/reactive/eventable'
class TestEventable
include Volt::Eventable
attr_reader :events_removed
def initialize
@events_removed = []
end
def event_removed(event, last, last_for_event)
@events_removed.push(event => [last, last_for_event])
end
def trigger_works_eve... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/volt/repos_spec.rb | spec/volt/repos_spec.rb | require 'spec_helper'
describe Volt::App do
[:cookies, :flash, :local_store].each do |repo|
it "should raise an error when accessing #{repo} from the server" do
expect do
volt_app.send(repo)
end.to raise_error("The #{repo} collection can only be accessed from the client side currently")
e... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/templates/targets/binding_document/component_node_spec.rb | spec/templates/targets/binding_document/component_node_spec.rb | require 'volt/page/targets/binding_document/component_node'
describe Volt::ComponentNode do
before do
html = <<-END
<!-- $0 -->Before <!-- $1 -->Inside<!-- $/1 --> After<!-- $/0 -->
END
@component = Volt::ComponentNode.new
@component.html = html
end
it 'should find a component from a bind... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/page/path_string_renderer_spec.rb | spec/page/path_string_renderer_spec.rb | require 'spec_helper'
require 'volt/page/path_string_renderer'
unless RUBY_PLATFORM == 'opal'
describe Volt::PathStringRenderer do
before do
kitchen_sink_path = File.expand_path(File.join(File.dirname(__FILE__), '../apps/kitchen_sink'))
@volt_app = Volt::App.new(kitchen_sink_path)
end
it 'sh... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/page/sub_context_spec.rb | spec/page/sub_context_spec.rb | require 'spec_helper'
require 'volt/page/sub_context'
describe Volt::SubContext do
it 'should respond_to correctly on locals' do
sub_context = Volt::SubContext.new(name: 'Name')
expect(sub_context.respond_to?(:name)).to eq(true)
expect(sub_context.respond_to?(:missing)).to eq(false)
end
it 'should ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/page/bindings/if_binding_spec.rb | spec/page/bindings/if_binding_spec.rb | require 'spec_helper'
class ::TestIfBindingController < Volt::ModelController
model :page
end
describe Volt::IfBinding do
it 'should render an if' do
dom = Volt::AttributeTarget.new(0)
context = ::TestIfBindingController.new(volt_app)
context._name = 'jimmy'
branches = [
[
proc { _n... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/page/bindings/template_binding_spec.rb | spec/page/bindings/template_binding_spec.rb | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false | |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/page/bindings/each_binding_spec.rb | spec/page/bindings/each_binding_spec.rb | require 'spec_helper'
class ::TestEachBindingController < Volt::ModelController
model :page
end
describe Volt::EachBinding do
it 'should render an each binding' do
dom = Volt::AttributeTarget.new(0)
context = ::TestEachBindingController.new(volt_app)
context._items << {name: 'One'}
context._items ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/page/bindings/content_binding_spec.rb | spec/page/bindings/content_binding_spec.rb | require 'spec_helper'
require 'volt/page/bindings/content_binding'
require 'volt/page/targets/attribute_target'
require 'volt/page/targets/dom_section'
require 'volt/page/template_renderer'
describe Volt::ContentBinding do
it 'should render the content in a content binding' do
dom = Volt::AttributeTarget.new(0)
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/page/bindings/template_binding/view_lookup_for_path_spec.rb | spec/page/bindings/template_binding/view_lookup_for_path_spec.rb | require 'spec_helper'
require 'volt/page/bindings/view_binding'
describe Volt::ViewBinding do
let(:view_lookup) { Volt::ViewLookupForPath.new(@templates, 'main/main/main') }
it 'should lookup nested controller action' do
@templates = {
'main/main/blog/nav' => '',
'main/comments/new/body' => ''
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/forking_server_spec.rb | spec/server/forking_server_spec.rb | require 'spec_helper'
unless RUBY_PLATFORM == 'opal'
require 'volt/server'
describe Volt::ForkingServer do
it 'should set polling an an option when using POLL_FS env' do
ENV['POLL_FS'] = 'true'
forking_server = Volt::ForkingServer.allocate
# Lots of stubs, since we're working with the FS
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/component_templates_spec.rb | spec/server/component_templates_spec.rb | if RUBY_PLATFORM == 'opal'
else
require 'spec_helper'
require 'benchmark'
require 'volt/server/component_templates'
describe Volt::ComponentTemplates do
let(:haml_handler) do
double(:haml_handler)
end
it 'can be extended' do
expect( Volt::ComponentTemplates::Preprocessors.extensions ).... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/socket_connection_handler_spec.rb | spec/server/socket_connection_handler_spec.rb | require 'spec_helper'
if RUBY_PLATFORM != 'opal'
require 'volt/server/socket_connection_handler'
describe Volt::SocketConnectionHandler do
let(:fake_dispatcher) { double("Dispatcher", volt_app: Volt.current_app)}
let(:fake_session) {double("Faye::WebSocket")}
before do
@old_dispatcher = Volt::S... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/rack/asset_files_spec.rb | spec/server/rack/asset_files_spec.rb | if RUBY_PLATFORM != 'opal'
require 'spec_helper'
require 'volt/server/rack/asset_files'
require 'volt/server/template_handlers/sprockets_component_handler'
describe Volt::AssetFiles do
before do
spec_app_root = File.join(File.dirname(__FILE__), '../../apps/file_loading')
@component_paths = Vo... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/rack/sprockets_helpers_setup.rb | spec/server/rack/sprockets_helpers_setup.rb | require 'spec_helper'
describe "sprockets helpers" do
it 'should expand paths' do
result = Volt::SprocketsHelpersSetup.expand('/something/cool/../awesome/beans/../../five/six/seven')
expect(result).to eq('/something/five/six/seven')
end
it 'should expand paths2' do
result = Volt::SprocketsHelpersSe... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/rack/http_resource_spec.rb | spec/server/rack/http_resource_spec.rb | if RUBY_PLATFORM != 'opal'
require 'volt/server/rack/http_resource'
require 'volt/controllers/http_controller'
require 'volt/server/rack/http_request'
require 'volt/router/routes'
describe Volt::HttpResource do
def routes(&block)
@routes = Volt::Routes.new
@routes.define(&block)
end
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/rack/http_response_header_spec.rb | spec/server/rack/http_response_header_spec.rb | require 'volt/server/rack/http_response_header'
describe Volt::HttpResponseHeader do
it 'it should headerize the keys' do
header = Volt::HttpResponseHeader.new
header[:content_type] = 'test'
expect(header['Content-Type']).to eq('test')
expect(header['content-type']).to eq('test')
expect(header['c... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/rack/http_request_spec.rb | spec/server/rack/http_request_spec.rb | if RUBY_PLATFORM != 'opal'
require 'volt/server/rack/http_request'
describe Volt::HttpRequest do
def env_for(url, opts = {})
Rack::MockRequest.env_for(url, opts)
end
it 'should report the correct format' do
env = env_for('http://example.com/test.html',
'CONTENT_TYPE' =>... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/rack/quite_common_logger_spec.rb | spec/server/rack/quite_common_logger_spec.rb | unless RUBY_PLATFORM == 'opal'
require 'spec_helper'
require 'volt/server/rack/quiet_common_logger'
describe QuietCommonLogger do
subject { QuietCommonLogger.new(nil, nil) }
let(:fake_class) { Class.new }
let(:app) { double 'App', call: [:status, :header, :body] }
before(:each) do
allow(ap... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/rack/rack_requests_spec.rb | spec/server/rack/rack_requests_spec.rb | require 'spec_helper'
if ENV['BROWSER'] && ENV['BROWSER'] == 'phantom'
describe 'Rack Requests', type: :feature do
it 'should send JS file with JS mimetype' do
visit '/app/components/main.js'
expect(page.response_headers['Content-Type']).to include 'application/javascript'
end
end
end
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/rack/http_response_renderer_spec.rb | spec/server/rack/http_response_renderer_spec.rb | require 'volt/server/rack/http_response_renderer'
describe Volt::HttpResponseRenderer do
let(:renderer) { Volt::HttpResponseRenderer.new }
it 'should render json' do
hash = { a: 'aa', bb: 'bbb' }
body, additional_headers = renderer.render json: hash
expect(body).to eq(hash.to_json)
expect(addition... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/rack/component_paths_spec.rb | spec/server/rack/component_paths_spec.rb | if RUBY_PLATFORM != 'opal'
require 'volt/server/rack/component_paths'
describe Volt::ComponentPaths do
before do
spec_app_root = File.join(File.dirname(__FILE__), '../../apps/file_loading')
path_to_main = File.join(File.dirname(__FILE__), '../../apps/file_loading/app/main')
@component_paths ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/middleware/middleware_stack_spec.rb | spec/server/middleware/middleware_stack_spec.rb | require 'spec_helper'
unless RUBY_PLATFORM == 'opal'
describe Volt::MiddlewareStack do
before do
@stack = Volt::MiddlewareStack.new
end
it 'should insert a middleware at the end of the stack when calling use' do
middleware1 = double('middleware1')
@stack.use(middleware1, 'arg1')
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/middleware/rack_content_types_spec.rb | spec/server/middleware/rack_content_types_spec.rb | if RUBY_PLATFORM != 'opal'
require 'spec_helper'
describe Rack::HttpContentTypes do
include Rack::Test::Methods
let(:app) { Volt.current_app.middleware }
describe 'with default parser' do
it "allows you to setup parsers for content types" do
middleware = Rack::HttpContentTypes.new Volt,... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/message_bus/message_encoder_spec.rb | spec/server/message_bus/message_encoder_spec.rb | require 'spec_helper'
unless RUBY_PLATFORM == 'opal'
describe Volt::MessageBus do
before do
# Stub socket stuff
allow_any_instance_of(Volt::MessageBus).to receive(:connect_to_peers).and_return(nil)
end
describe "encryption" do
before do
@msg_bus_config = double('volt/config')
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/message_bus/peer_to_peer_spec.rb | spec/server/message_bus/peer_to_peer_spec.rb | require 'spec_helper'
unless RUBY_PLATFORM == 'opal'
describe Volt::MessageBus::PeerToPeer do
before do
# Stub socket stuff
allow_any_instance_of(Volt::MessageBus::PeerToPeer).to receive(:connect_to_peers).and_return(nil)
end
end
end | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/message_bus/peer_to_peer/peer_server_spec.rb | spec/server/message_bus/peer_to_peer/peer_server_spec.rb | require 'spec_helper'
unless RUBY_PLATFORM == 'opal'
describe Volt::MessageBus::PeerServer do
describe "ip and ports" do
before do
allow_any_instance_of(Volt::MessageBus::PeerServer).to receive(:run_server)
end
it 'should use Volt.config.message_bus.bind_port_ranges to connect' do
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/message_bus/peer_to_peer/peer_connection_spec.rb | spec/server/message_bus/peer_to_peer/peer_connection_spec.rb | require 'spec_helper'
unless RUBY_PLATFORM == 'opal'
describe Volt::MessageBus::PeerConnection do
describe 'pass the server_id back and forth' do
before do
@socket = double('socket')
@bus = double('message bus')
expect(@bus).to receive(:server_id).and_return('server one')
e... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/message_bus/peer_to_peer/socket_with_timeout_spec.rb | spec/server/message_bus/peer_to_peer/socket_with_timeout_spec.rb | require 'spec_helper'
unless RUBY_PLATFORM == 'opal'
describe Volt::SocketWithTimeout do
it 'should setup a connection manually and then specify a timeout' do
allow_any_instance_of(Socket).to receive(:connect)
Volt::SocketWithTimeout.new('google.com', 80, 10)
end
end
end | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/html_parser/view_parser_spec.rb | spec/server/html_parser/view_parser_spec.rb | if RUBY_PLATFORM == 'opal'
else
require 'benchmark'
require 'volt/server/html_parser/view_parser'
describe Volt::ViewParser do
it 'should parse content bindings' do
html = '<p>Some {{ content }} binding, {{ name }}</p>'
view = Volt::ViewParser.new(html, 'main/main/main')
expect(view.templates).to eq('m... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/html_parser/sandlebars_parser_spec.rb | spec/server/html_parser/sandlebars_parser_spec.rb | if RUBY_PLATFORM == 'opal'
else
require 'spec_helper'
require 'benchmark'
require 'volt/server/html_parser/sandlebars_parser'
class HTMLHandler
attr_reader :html
def initialize
@html = ''
end
def comment(comment)
@html << "<!--#{comment}-->"
end
def text(text)
@html << text
end
def bind... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/html_parser/view_scope_spec.rb | spec/server/html_parser/view_scope_spec.rb | require 'spec_helper'
describe Volt::ViewScope do
describe "methodize strings" do
def methodize(str)
Volt::ViewScope.methodize_string(str)
end
it 'should methodize a method without args' do
code = methodize('something')
expect(code).to eq('method(:something)')
end
it 'should m... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/server/html_parser/view_handler_spec.rb | spec/server/html_parser/view_handler_spec.rb | if RUBY_PLATFORM == 'opal'
else
require 'benchmark'
require 'volt/server/html_parser/view_handler'
describe Volt::ViewHandler do
let(:handler) { Volt::ViewHandler.new('main/main/main') }
it 'handles tags' do
handler.comment('Yowza!')
handler.start_tag('a', { href: 'yahoo.com' }, false)
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/router/routes_spec.rb | spec/router/routes_spec.rb | require 'volt/router/routes'
require 'volt/models'
def routes(&block)
@routes = Volt::Routes.new
@routes.define(&block)
end
describe Volt::Routes do
it 'should setup direct routes' do
routes do
client '/', view: 'index'
client '/page1', view: 'first_page'
get '/page2', controller: 'page', ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/extra_core/symbol_spec.rb | spec/extra_core/symbol_spec.rb | if RUBY_PLATFORM == 'opal'
else
require 'spec_helper'
require 'volt/extra_core/symbol'
describe Symbol do
it 'should pluralize correctly' do
expect(:car.pluralize).to eq(:cars)
end
it 'should singularize correctly' do
expect(:cars.singularize).to eq(:car)
end
end
end
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/extra_core/inflector_spec.rb | spec/extra_core/inflector_spec.rb | require 'spec_helper'
require 'volt/extra_core/inflector'
describe Volt::Inflector do
it 'should pluralize correctly' do
expect('car'.pluralize).to eq('cars')
# expect('database'.pluralize).to eq('database')
end
it 'should singularize correctly' do
expect('cars'.singularize).to eq('car')
end
end
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/extra_core/blank_spec.rb | spec/extra_core/blank_spec.rb | require 'spec_helper'
describe 'blank' do
it 'should report blank when blank' do
expect(' '.blank?).to eq(true)
end
it 'should report not blank when not blank' do
expect(' text '.blank?).to eq(false)
end
end
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/extra_core/array_spec.rb | spec/extra_core/array_spec.rb | require 'spec_helper'
require 'volt/extra_core/array'
describe Array do
describe '#sum' do
it 'calculates sum of array of integers' do
expect([1, 2, 3].sum).to eq(6)
end
end
describe "#to_sentence" do
it 'should return an empty string' do
expect([].to_sentence).to eq('')
end
it ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/extra_core/class_spec.rb | spec/extra_core/class_spec.rb | require 'spec_helper'
require 'volt/extra_core/array'
class TestClassAttributes
class_attribute :some_data
class_attribute :attr2
end
class TestSubClassAttributes < TestClassAttributes
end
class TestSubClassAttributes2 < TestClassAttributes
end
describe 'extra_core class addons' do
it 'should provide class_at... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/extra_core/string_transformations_spec.rb | spec/extra_core/string_transformations_spec.rb | # encoding: utf-8
require 'spec_helper'
require 'extra_core/string_transformation_test_cases'
require 'volt/extra_core/string'
describe '#camelize' do
CamelToUnderscore.each do |camel, underscore|
it 'camelizes' do
expect(underscore.camelize).to eq(camel)
end
end
it 'camelizes lower' do
expect... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/extra_core/object_spec.rb | spec/extra_core/object_spec.rb | require 'spec_helper'
require 'volt/extra_core/blank'
describe Object do
it 'should add blank? to all objects' do
expect(Object.new.blank?).to eq(false)
expect(nil.blank?).to eq(true)
end
it 'should add present? to all objects' do
expect(Object.new.present?).to eq(true)
expect(nil.present?).to e... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/extra_core/string_transformation_test_cases.rb | spec/extra_core/string_transformation_test_cases.rb | CamelToUnderscore = {
'Product' => 'product',
'SpecialGuest' => 'special_guest',
'ApplicationController' => 'application_controller',
'Area51Controller' => 'area51_controller'
}
UnderscoreToLowerCamel = {
'product' => 'product',
'special_guest' ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/extra_core/hash_spec.rb | spec/extra_core/hash_spec.rb | require 'spec_helper'
describe Hash do
it 'should return a hash without the speicified keys' do
a = {one: 1, two: 2, three: 3}
expect(a.without(:one, :three)).to eq({two: 2})
end
end | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/spec/extra_core/logger_spec.rb | spec/extra_core/logger_spec.rb | if RUBY_PLATFORM != 'opal'
describe Volt::VoltLogger do
let(:args) { [5, :arg2] }
let(:class_name) { 'ClassName' }
let(:method_name) { 'method_name' }
let(:run_time) { 50 }
let(:logger) { Volt::VoltLogger.new }
let(:logger_with_opts) do
Volt::VoltLogger.new(args: args,
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.