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
gangelo/dsu
https://github.com/gangelo/dsu
lib/dsu/subcommands/theme.rb
Ruby
mit
49
main
5,814
# frozen_string_literal: true require_relative '../env' require_relative '../support/fileable' require_relative '../views/color_theme/index' require_relative '../views/color_theme/show' require_relative '../views/shared/error' require_relative '../views/shared/info' require_relative 'base_subcommand' module Dsu mod...
github
gangelo/dsu
https://github.com/gangelo/dsu
lib/dsu/subcommands/export.rb
Ruby
mit
49
main
2,506
# frozen_string_literal: true require_relative '../presenters/export/all_presenter' require_relative '../presenters/export/dates_presenter' require_relative '../support/command_options/dsu_times' require_relative '../support/command_options/time_mnemonic' require_relative '../support/time_formatable' require_relative ...
github
gangelo/dsu
https://github.com/gangelo/dsu
lib/dsu/subcommands/list.rb
Ruby
mit
49
main
4,435
# frozen_string_literal: true require_relative '../presenters/entry_group/list/date_presenter' require_relative '../presenters/entry_group/list/dates_presenter' require_relative '../services/entry_group/counter_service' require_relative '../support/command_options/dsu_times' require_relative '../support/command_option...
github
gangelo/dsu
https://github.com/gangelo/dsu
lib/dsu/subcommands/config.rb
Ruby
mit
49
main
3,042
# frozen_string_literal: true require_relative '../models/configuration' require_relative '../views/configuration/show' require_relative '../views/shared/model_errors' require_relative '../views/shared/success' require_relative '../views/shared/warning' require_relative 'base_subcommand' module Dsu module Subcomman...
github
gangelo/dsu
https://github.com/gangelo/dsu
lib/dsu/subcommands/import.rb
Ruby
mit
49
main
3,244
# frozen_string_literal: true require_relative '../presenters/import/all_presenter' require_relative '../presenters/import/dates_presenter' require_relative '../support/command_options/dsu_times' require_relative '../support/command_options/time_mnemonic' require_relative '../support/time_formatable' require_relative ...
github
gangelo/dsu
https://github.com/gangelo/dsu
lib/dsu/subcommands/base_subcommand.rb
Ruby
mit
49
main
214
# frozen_string_literal: true require_relative '../base_cli' require_relative '../support/ask' module Dsu module Subcommands class BaseSubcommand < Dsu::BaseCLI include Support::Ask end end end
github
gangelo/dsu
https://github.com/gangelo/dsu
lib/dsu/subcommands/project.rb
Ruby
mit
49
main
6,597
# frozen_string_literal: true require_relative '../presenters/project/create_presenter' require_relative '../presenters/project/delete_presenter' require_relative '../presenters/project/list_presenter' require_relative '../presenters/project/use_by_number_presenter' require_relative '../presenters/project/use_presente...
github
gangelo/dsu
https://github.com/gangelo/dsu
lib/dsu/subcommands/browse.rb
Ruby
mit
49
main
1,785
# frozen_string_literal: true require 'io/console' require_relative '../services/stdout_redirector_service' require_relative '../support/command_options/dsu_times' require_relative '../support/command_options/time_mnemonic' require_relative '../support/entry_group_browsable' require_relative '../support/time_formatab...
github
gangelo/dsu
https://github.com/gangelo/dsu
lib/dsu/subcommands/edit.rb
Ruby
mit
49
main
1,844
# frozen_string_literal: true require_relative 'base_subcommand' require_relative '../models/entry_group' require_relative '../views/entry_group/show' module Dsu module Subcommands class Edit < BaseSubcommand # TODO: I18n. map %w[d] => :date map %w[n] => :today map %w[t] => :tomorrow ...
github
gangelo/dsu
https://github.com/gangelo/dsu
lib/dsu/subcommands/delete.rb
Ruby
mit
49
main
4,694
# frozen_string_literal: true require_relative '../services/entry_group/counter_service' require_relative '../services/entry_group/deleter_service' require_relative '../support/command_options/dsu_times' require_relative '../support/command_options/time_mnemonic' require_relative '../support/time_formatable' require_r...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/spec_helper.rb
Ruby
mit
49
main
1,424
# frozen_string_literal: true require 'dotenv/load' require 'factory_bot' require 'ffaker' require 'fileutils' require 'pry-byebug' require 'securerandom' require 'tempfile' require 'time' require 'yaml' require_relative 'support/custom_matchers' require 'simplecov' SimpleCov.start do add_filter 'spec' end if Fi...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/support/description_string_helpers.rb
Ruby
mit
49
main
350
# frozen_string_literal: true module DescriptionStringHelpers def description_having(max_length: Dsu::Support::ShortString::SHORT_STRING_MAX_COUNT) num_words = Dsu::Support::ShortString::SHORT_STRING_MAX_COUNT FFaker::Lorem.words(num_words).join(' ')[0...max_length].tap do |desc| desc[-1] = 'x' if desc...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/support/stdxxx_helpers.rb
Ruby
mit
49
main
558
# frozen_string_literal: true module StdxxxHelpers def strip_escapes(escaped_string) escaped_string.gsub(/\e\[[0-9;]*[a-zA-Z]/, '') end def stub_import_prompt(response:) allow($stdin).to receive(:getch) do response.is_a?(Array) ? response.shift : response end end def capture_stdout_and_st...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/support/custom_matchers.rb
Ruby
mit
49
main
1,117
# frozen_string_literal: true RSpec::Matchers.define :validate_with_validator do |validator_class| match do |model| return validates_with?(model, validator_class) unless on_attribute? model.class.validators_on(attribute).any?(validator_class) end chain :on do |attribute_name| self.attribute = attri...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/support/mock_migration_version_helpers.rb
Ruby
mit
49
main
3,683
# frozen_string_literal: true # NOTE: This expects the "mock_and_cleanup_dirs" shared context # to be included in the spec file where it is used. module MockMigrationVersionHepers def mock_migration_version_for(version:) remove_mock_dsu_folder_and_configuration create_mock_dsu_folder_for(version) creat...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/support/time_helpers.rb
Ruby
mit
49
main
1,651
# frozen_string_literal: true # This module provides methods to help with Time # objects module TimeHelpers def current_year Time.now.in_time_zone.year end def freeze_time_at(time_string:) allow(Time).to receive(:now).and_return(Time.parse(time_string)) end def today_yyyymmdd_string to_yyyymmdd...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/support/color_theme_helpers.rb
Ruby
mit
49
main
739
# frozen_string_literal: true # These helpers are used to create and delete the configuration file # typically before and after every test. module ColorThemeHelpers def create_color_theme!(theme_name:, theme_hash:) Dsu::Models::ColorTheme.new(theme_name: theme_name, theme_hash: theme_hash).save! end def cre...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/support/shared_examples/color_theme.rb
Ruby
mit
49
main
532
# frozen_string_literal: true shared_examples 'the color theme is the current color theme in the configuration' do it 'the color theme is the current configuration color theme' do expect(Dsu::Models::ColorTheme.current_or_default.theme_name).to eq(theme_name) end end shared_examples 'the color theme is not th...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/support/shared_examples/projects.rb
Ruby
mit
49
main
1,626
# frozen_string_literal: true shared_examples 'the project does not exist' do it 'returns true' do expect(!project.exist?).to be true end end shared_examples 'the project exists' do it 'exists and is initialized' do expect(project.project_initialized?).to be true end end shared_examples 'the project ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/support/shared_examples/errors_and_validation.rb
Ruby
mit
49
main
942
# frozen_string_literal: true # NOTE: This example group should ONLY be used to test errors # that are raised during processing (i.e. where no validation # methods need to be called on the subject.). shared_examples 'an error is raised' do it 'raises an error' do expect { subject }.to raise_error(expected_error)...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/support/shared_examples/import.rb
Ruby
mit
49
main
4,002
# frozen_string_literal: true shared_examples 'the import file does not exist' do let(:options) { { override: false } } context 'when the import file does not exist' do let(:import_file_path) { 'spec/fixtures/files/does-not-exist.csv' } it "displays the 'import file does not exist' message" do expe...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/support/shared_examples/project_rename.rb
Ruby
mit
49
main
3,794
# frozen_string_literal: true shared_examples 'a message is displayed when the new project already exists' do context 'when the new project already exists' do before do new_project.save! end let(:expected_error) do "A project for new project name \"#{new_project.project_name}\" already exist...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/support/shared_contexts/mock_and_cleanup_dirs.rb
Ruby
mit
49
main
1,875
# frozen_string_literal: true RSpec.shared_context 'when dir mock and cleanup is needed' do before do # Mock Dir.home and Dir.tmpdir to return the temporary directories allow(Dir).to receive_messages(home: temp_folder, tmpdir: temp_folder) allow(Tempfile).to receive(:new).with('dsu').and_return(temp_file...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/factories/entries.rb
Ruby
mit
49
main
306
# frozen_string_literal: true FactoryBot.define do factory :entry, class: 'Dsu::Models::Entry' do description { FFaker::Lorem.words(rand(2..80)).join(' ')[0...80] } trait :invalid do description { '' } end initialize_with do new(description: description) end end end
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/factories/delete_presenters.rb
Ruby
mit
49
main
761
# frozen_string_literal: true FactoryBot.define do factory :delete_presenter, class: 'Dsu::Presenters::Project::DeletePresenter' do project_name { 'test' } options { {} } initialize_with do new(project_name: project_name, options: options) end trait :with_default_project do project_...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/factories/use_presenters.rb
Ruby
mit
49
main
752
# frozen_string_literal: true FactoryBot.define do factory :use_presenter, class: 'Dsu::Presenters::Project::UsePresenter' do project_name { 'test' } options { {} } initialize_with do new(project_name: project_name, options: options) end trait :with_default_project do project_name d...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/factories/delete_by_number_presenters.rb
Ruby
mit
49
main
1,069
# frozen_string_literal: true FactoryBot.define do factory :delete_by_number_presenter, class: 'Dsu::Presenters::Project::DeleteByNumberPresenter' do project_number { 2 } options { {} } initialize_with do new(project_number: project_number, options: options) end trait :with_default_projec...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/factories/configurations.rb
Ruby
mit
49
main
1,079
# frozen_string_literal: true FactoryBot.define do factory :configuration, class: 'Dsu::Models::Configuration' do options { {} } transient do config_hash { nil } color_theme { nil } # A project object to act as our configuraiotn default_project. default_project { nil } end ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/factories/list_presenters.rb
Ruby
mit
49
main
1,033
# frozen_string_literal: true FactoryBot.define do factory :list_presenter, class: 'Dsu::Presenters::Project::ListPresenter' do options { {} } transient do project_names { %w[Test1 Test2] } without_projects { false } end initialize_with do new(options: options) end after(...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/factories/use_by_number_presenters.rb
Ruby
mit
49
main
1,057
# frozen_string_literal: true FactoryBot.define do factory :use_by_number_presenter, class: 'Dsu::Presenters::Project::UseByNumberPresenter' do project_number { 2 } options { {} } initialize_with do new(project_number: project_number, options: options) end trait :with_default_project do ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/factories/create_presenters.rb
Ruby
mit
49
main
773
# frozen_string_literal: true FactoryBot.define do factory :create_presenter, class: 'Dsu::Presenters::Project::CreatePresenter' do project_name { 'test' } description { nil } options { {} } transient do with_project { true } end initialize_with do new(project_name: project_name...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/factories/color_themes.rb
Ruby
mit
49
main
490
# frozen_string_literal: true FactoryBot.define do factory :color_theme, class: 'Dsu::Models::ColorTheme' do theme_name { Dsu::Models::ColorTheme::DEFAULT_THEME_NAME.dup } theme_hash { Dsu::Models::ColorTheme::DEFAULT_THEME.dup } initialize_with do unless theme_name == Dsu::Models::ColorTheme::DEF...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/factories/projects.rb
Ruby
mit
49
main
839
# frozen_string_literal: true FactoryBot.define do factory :project, class: 'Dsu::Models::Project' do project_name { 'default' } description { nil } options { {} } version { Dsu::Migration::VERSION } initialize_with do new(project_name: project_name, description: description, version: vers...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/factories/migration_versions.rb
Ruby
mit
49
main
460
# frozen_string_literal: true FactoryBot.define do factory :migration_version, class: 'Dsu::Models::MigrationVersion' do version { nil } options { {} } trait :with_current_version do version { Dsu::Migration::VERSION } end initialize_with do Dsu::Models::MigrationVersion.new(version...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/factories/entry_groups.rb
Ruby
mit
49
main
983
# frozen_string_literal: true FactoryBot.define do factory :entry_group, class: 'Dsu::Models::EntryGroup' do transient do # Use this if you want to control the entries added # to this entry group. entries { [] } end time { nil } version { Dsu::Models::EntryGroup::VERSION } # U...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/core/ruby/wrap_and_join_spec.rb
Ruby
mit
49
main
1,485
# frozen_string_literal: true require 'active_support/core_ext/date/calculations' RSpec.describe WrapAndJoin do describe 'constants' do describe 'WRAP_AND_JOIN_JOIN_TOKEN' do it 'defines the constant' do expect(Array.const_defined?(:WRAP_AND_JOIN_JOIN_TOKEN)).to be true end it 'assign...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/validators/version_validator_spec.rb
Ruby
mit
49
main
889
# frozen_string_literal: true RSpec.describe Dsu::Validators::VersionValidator do subject(:version_validator) do Class.new do include ActiveModel::Model attr_reader :version class << self def name 'Test' end end def initialize(version:) @version ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/validators/color_theme_validator_spec.rb
Ruby
mit
49
main
3,645
# frozen_string_literal: true RSpec.describe Dsu::Validators::ColorThemeValidator do subject(:color_theme_validator) do Dsu::Models::ColorTheme.new(theme_name: theme_name, theme_hash: theme_hash) end shared_examples 'the extra key/value pairs are ignored' do it 'passes validation' do expect(subjec...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/validators/description_validator_spec.rb
Ruby
mit
49
main
829
# frozen_string_literal: true RSpec.describe Dsu::Validators::DescriptionValidator do subject(:description_validator) do Class.new do include ActiveModel::Model class << self def name 'Test' end end attr_reader :description def initialize(description:) ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/validators/entries_validator_spec.rb
Ruby
mit
49
main
2,238
# frozen_string_literal: true RSpec.describe Dsu::Validators::EntriesValidator do subject(:entries_validator) do Class.new do include ActiveModel::Model class << self def name 'Test' end end attr_accessor :entries def initialize(entries:) @entrie...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/support/project_file_system_spec.rb
Ruby
mit
49
main
3,784
# frozen_string_literal: true RSpec.describe Dsu::Support::ProjectFileSystem do subject(:project_file_system) do Class.new do include Dsu::Support::ProjectFileSystem attr_reader :project_name def initialize(project_name:) @project_name = project_name end end.new(project_name...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/support/times_sortable_spec.rb
Ruby
mit
49
main
5,272
# frozen_string_literal: true RSpec.describe Dsu::Support::TimesSortable do subject(:times_sortable) { described_class } let(:time) { Time.now } let(:times) { [time.yesterday, time, time.tomorrow] } let(:entries_display_order) { :asc } describe '.times_sort' do context 'when the arguments are invalid' ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/support/fileable_spec.rb
Ruby
mit
49
main
727
# frozen_string_literal: true RSpec.describe Dsu::Support::Fileable do describe 'sanity checks' do describe 'Dir.home' do it 'returns the correct mocked folder' do expect(Dir.home).to eq temp_folder end end describe 'Dir.tmpdir' do it 'returns the correct mocked folder' do ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/support/time_formatable_spec.rb
Ruby
mit
49
main
3,590
# frozen_string_literal: true # TODO: Add additional specs for the other methods in this module. RSpec.describe Dsu::Support::TimeFormatable do describe '.formatted_time' do shared_examples 'the time is formatted correctly' do it 'returns the formatted time' do expect(described_class.formatted_time...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/support/descriptable_spec.rb
Ruby
mit
49
main
2,767
# frozen_string_literal: true RSpec.describe Dsu::Support::Descriptable, type: :module do subject(:descriptable) do Class.new do include Dsu::Support::Descriptable attr_reader :description def initialize(description) @description = description end end.new(description) end ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/support/entry_group_browsable_spec.rb
Ruby
mit
49
main
1,128
# frozen_string_literal: true RSpec.describe Dsu::Support::EntryGroupBrowsable do subject(:entry_group_browsable) do Class.new do include Dsu::Support::EntryGroupBrowsable def configuration @configuration ||= FactoryBot.build(:configuration) # rubocop:disable FactoryBot/SyntaxMethods e...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/support/short_string_spec.rb
Ruby
mit
49
main
2,628
# frozen_string_literal: true RSpec.describe Dsu::Support::ShortString, type: :module do subject(:short_string) { described_class.short_string(string: description) } let(:max_desc) { described_class::SHORT_STRING_MAX_COUNT } describe '::SHORT_STRING_MAX_COUNT' do it 'defines the constant' do expect(d...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/support/command_options/time_mnemonics_spec.rb
Ruby
mit
49
main
560
# frozen_string_literal: true RSpec.describe Dsu::Support::CommandOptions::TimeMnemonics do describe 'constants' do it 'defines TODAY' do expect(described_class::TODAY).to match_array(%w[n today]) end it 'defines TOMORROW' do expect(described_class::TOMORROW).to match_array(%w[t tomorrow]) ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/support/command_options/time_spec.rb
Ruby
mit
49
main
2,761
# frozen_string_literal: true RSpec.describe Dsu::Support::CommandOptions::Time do before do allow(Time).to receive(:now).and_call_original end describe '.time_from_date_string' do subject(:time) do described_class.time_from_date_string(command_option: command_option) end context 'when th...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/support/command_options/dsu_times_spec.rb
Ruby
mit
49
main
4,631
# frozen_string_literal: true # rubocop:disable RSpec/NestedGroups RSpec.describe Dsu::Support::CommandOptions::DsuTimes do subject(:from_to_time) { described_class } shared_examples 'the correct times are returned' do it 'returns the expected times' do times, _errors = from_to_time expect(to_yyyy...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/support/command_options/time_mnemonic_spec.rb
Ruby
mit
49
main
8,146
# frozen_string_literal: true RSpec.shared_examples 'the correct time is returned' do it 'returns the expected time' do expect(to_yyyymmdd_string(time_from_mnemonic)).to eq(to_yyyymmdd_string(expected_time)) end end # rubocop:disable RSpec/NestedGroups RSpec.describe Dsu::Support::CommandOptions::TimeMnemonic...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/command_services/add_entry_service_spec.rb
Ruby
mit
49
main
2,443
# frozen_string_literal: true RSpec.describe Dsu::CommandServices::AddEntryService do let(:entry) { build(:entry) } let(:time) { Time.now } describe '#initialize' do subject(:add_entry_service) { described_class.new(entry: entry, time: time) } context 'when the arguments are valid' do it_behaves_...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/features/dsu_edit_features_spec.rb
Ruby
mit
49
main
2,637
# frozen_string_literal: true RSpec.describe 'Dsu edit features', type: :feature do subject(:cli) { Dsu::CLI.start(args) } shared_examples 'the entry group for the entry date is edited' do before do with_entries mock_editor(entry_group: entry_group) end let(:entry_group) { Dsu::Models::En...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/features/dsu_theme_features_spec.rb
Ruby
mit
49
main
8,637
# frozen_string_literal: true RSpec.describe 'Dsu theme features', type: :feature do subject(:cli) { Dsu::CLI.start(args) } let(:theme_name) { 'test' } shared_examples 'the color theme exists' do it 'creates the color theme' do cli expect(Dsu::Models::ColorTheme.exist?(theme_name: theme_name))....
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/features/dsu_version_features_spec.rb
Ruby
mit
49
main
739
# frozen_string_literal: true RSpec.describe 'Dsu info features', type: :feature do subject(:cli) { Dsu::CLI.start(args) } context "when 'dsu help version' is called" do let(:args) { %w[help version] } it 'displays help' do expect { cli }.to output(/Usage:.*rspec version/m).to_stdout end end ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/features/dsu_browse_feature_spec.rb
Ruby
mit
49
main
5,263
# frozen_string_literal: true RSpec.describe 'Dsu browse features', type: :feature do subject(:cli) do strip_escapes(Dsu::Services::StdoutRedirectorService.call { Dsu::CLI.start(args) }) end shared_examples 'help is displayed' do it 'displays help' do expect(cli).to include('rspec browse help [COM...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/features/dsu_add_features_spec.rb
Ruby
mit
49
main
6,150
# frozen_string_literal: true RSpec.describe 'Dsu add features', type: :feature do subject(:cli) do capture_stdout_and_strip_escapes { Dsu::CLI.start(args) } end let(:args) { %w[add] } let(:with_entries) do Dir.glob(File.join('spec/fixtures/files/entries', '*')).each do |file_path| file_name = F...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/features/dsu_list_features_spec.rb
Ruby
mit
49
main
8,069
# frozen_string_literal: true RSpec.describe 'Dsu list features', type: :feature do subject(:cli) { Dsu::CLI.start(args) } shared_examples 'the entry group is listed' do let(:expected_output) do Dsu::Services::StdoutRedirectorService.call do view_entry_groups(times) end end it 'li...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/features/dsu_config_features_spec.rb
Ruby
mit
49
main
866
# frozen_string_literal: true RSpec.describe 'Dsu config features', type: :feature do subject(:cli) { Dsu::CLI.start(args) } let(:args) { %w[config] } let(:with_config) do file_path = 'spec/fixtures/files/.dsu' file_name = File.basename(file_path) destination_path = File.join(Dsu::Support::Fileable....
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/features/dsu_info_features_spec.rb
Ruby
mit
49
main
2,134
# frozen_string_literal: true RSpec.describe 'Dsu info features', type: :feature do subject(:cli) { Dsu::CLI.start(args) } context "when 'dsu help info' is called" do let(:args) { %w[help info] } it 'displays help' do expect { cli }.to output(/Usage:.*rspec info/m).to_stdout end end contex...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/features/dsu_delete_features_spec.rb
Ruby
mit
49
main
8,474
# frozen_string_literal: true RSpec.describe 'Dsu delete features', type: :feature do subject(:cli) { Dsu::CLI.start(args) } shared_examples 'the entry groups are deleted' do |deleted_count| let(:expected_output) do Dsu::Services::StdoutRedirectorService.call do message = I18n.t('subcommands.del...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/models/migration_version_spec.rb
Ruby
mit
49
main
1,836
# frozen_string_literal: true # rubocop:disable Style/NumericLiterals RSpec.describe Dsu::Models::MigrationVersion do describe '#initialize' do subject(:migration_version) { build(:migration_version) } context 'when the migration version file does not exist' do specify 'the migration version file does...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/models/configuration_spec.rb
Ruby
mit
49
main
7,373
# frozen_string_literal: true RSpec.describe Dsu::Models::Configuration do subject(:config) { build(:configuration, config_hash: config_hash) } let(:config_hash) { described_class::DEFAULT_CONFIGURATION } describe 'constants' do describe 'VERSION' do it 'defines the right version type' do exp...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/models/project_spec.rb
Ruby
mit
49
main
21,223
# frozen_string_literal: true RSpec.describe Dsu::Models::Project do subject(:project) do described_class.new(project_name: project_name, description: description, version: version, options: options) end let(:project_name) { 'Test' } let(:description) { nil } let(:version) { nil } let(:options) { {} }...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/models/entry_spec.rb
Ruby
mit
49
main
2,459
# frozen_string_literal: true RSpec.describe Dsu::Models::Entry do subject(:entry) do # All defaults are set up to instantiate without errors # or vailidation errors by default. described_class.new(description: description) end let(:description) { entry_hash[:description] } let(:entry_hash) do ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/models/color_theme_spec.rb
Ruby
mit
49
main
12,011
# frozen_string_literal: true RSpec.describe Dsu::Models::ColorTheme do subject(:color_theme) do described_class.new(theme_name: theme_name, theme_hash: theme_hash) end shared_examples 'the color theme exists' do it 'the color theme file exists' do theme_path = Dsu::Support::Fileable.themes_path(t...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/models/entry_group_spec.rb
Ruby
mit
49
main
16,904
# frozen_string_literal: true RSpec.describe Dsu::Models::EntryGroup do subject(:entry_group) { build(:entry_group, time: time, entries: entries) } before do build(:configuration, config_hash: Dsu::Models::Configuration::DEFAULT_CONFIGURATION) end let(:time) { Time.now } let(:entries) { [] } describ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/migration/migrator_spec.rb
Ruby
mit
49
main
3,629
# frozen_string_literal: true RSpec.describe Dsu::Migration::Migrator, type: :migration do before do mock_migration_version_for(version: migration_version) migration_services.each do |migration_service| allow(migration_service).to receive(:run_migration!).and_call_original end end let(:options...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/migration/base_service_spec.rb
Ruby
mit
49
main
5,244
# frozen_string_literal: true # rubocop:disable RSpec/NestedGroups RSpec.describe Dsu::Migration::BaseService, type: :migration do subject(:base_service) { described_class.new(options: options) } let(:options) { { pretend: false } } describe '#initialize' do it 'does not raise an error' do expect { b...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/migration/v20240210161248/service_spec.rb
Ruby
mit
49
main
2,622
# frozen_string_literal: true RSpec.describe Dsu::Migration::V20240210161248::Service, type: :migration do subject(:service) { described_class.new(options: options) } before do create(:migration_version, version: migration_version, options: options) end let(:options) { {} } let(:migration_version) { 20...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/migration/v20230613121411/service_spec.rb
Ruby
mit
49
main
2,854
# frozen_string_literal: true RSpec.describe Dsu::Migration::V20230613121411::Service, type: :migration do subject(:service) { described_class.new(options: options) } before do create(:migration_version, version: migration_version, options: options) end let(:dsu_folder) { File.join(temp_folder, 'dsu') } ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/services/entry_group/exporter_service_spec.rb
Ruby
mit
49
main
3,772
# frozen_string_literal: true RSpec.describe Dsu::Services::EntryGroup::ExporterService do subject(:service) { described_class.new(project_name: project_name, entry_groups: entry_groups, options: options) } shared_examples 'an entry_groups argument error is raised' do it_behaves_like 'an error is raised' en...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/services/entry_group/editor_service_spec.rb
Ruby
mit
49
main
7,766
# frozen_string_literal: true RSpec.describe Dsu::Services::EntryGroup::EditorService do subject(:entry_group_editor_service) { described_class.new(entry_group: entry_group) } let(:time) { entry_group.time } let(:entry_group) { build(:entry_group, time: Time.now, entries: build_list(:entry, 2)) } let!(:origin...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/services/entry_group/deleter_service_spec.rb
Ruby
mit
49
main
1,588
# frozen_string_literal: true RSpec.describe Dsu::Services::EntryGroup::DeleterService do subject(:service) { described_class.new(times: times) } let(:time_now) { Time.now.in_time_zone } let(:times) { [] } describe '#initialize' do context 'when argument :times is nil' do let(:times) { nil } ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/services/entry_group/counter_service_spec.rb
Ruby
mit
49
main
1,291
# frozen_string_literal: true RSpec.describe Dsu::Services::EntryGroup::CounterService do subject(:service) { described_class.new(times: times) } let(:time_now) { Time.now.in_time_zone } let(:times) { [] } describe '#initialize' do context 'when argument :times is nil' do let(:times) { nil } ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/services/entry_group/importer_service_spec.rb
Ruby
mit
49
main
10,699
# frozen_string_literal: true # rubocop:disable RSpec/MultipleMemoizedHelpers RSpec.describe Dsu::Services::EntryGroup::ImporterService do subject(:service) { described_class.new(import_projects: import_projects, options: options) } shared_examples 'an import_projects argument error is raised' do it_behaves_l...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/services/entry_group/browse_service_spec.rb
Ruby
mit
49
main
4,776
# frozen_string_literal: true RSpec.describe Dsu::Services::EntryGroup::BrowseService do subject(:service) { described_class.new(time: time, options: options) } let(:time) { Time.now.localtime } let(:options) { { browse: :week } } describe '#initialize' do context 'when argument :time is nil' do le...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/services/project/rename_service_spec.rb
Ruby
mit
49
main
4,899
# frozen_string_literal: true RSpec.describe Dsu::Services::Project::RenameService do subject(:rename_service) do described_class.new( from_project_name: from_project.project_name, to_project_name: to_project.project_name, to_project_description: to_project.description, options: options ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/presenters/entry_group/list/dates_presenter_spec.rb
Ruby
mit
49
main
4,831
# frozen_string_literal: true RSpec.describe Dsu::Presenters::EntryGroup::List::DatesPresenter do subject(:presenter) do described_class.new(times: times, options: options) end shared_examples 'the presenter raises an error' do let(:expected_error) do 'display_nothing_to_list_message called when t...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/presenters/entry_group/list/date_presenter_spec.rb
Ruby
mit
49
main
3,689
# frozen_string_literal: true RSpec.describe Dsu::Presenters::EntryGroup::List::DatePresenter do subject(:presenter) do described_class.new(times: times, options: options) end shared_examples 'the presenter raises an error' do let(:expected_error) do 'display_nothing_to_list_message called when th...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/crud/json_file_spec.rb
Ruby
mit
49
main
4,871
# frozen_string_literal: true def json_file_hash_for(file_path) Dsu::Crud::JsonFile.read!(file_path: file_path) end RSpec.describe Dsu::Crud::JsonFile do subject(:json_file) do Class.new(described_class) do def initialize(file_path, file_data) super(file_path) @file_data = file_data ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/views/import_dates_spec.rb
Ruby
mit
49
main
955
# frozen_string_literal: true RSpec.describe Dsu::Views::ImportDates do subject(:import_view) { described_class.new(presenter: presenter, options: options) } let(:options) { {} } let(:import_file_path) { 'spec/fixtures/files/import.csv' } let(:from) { Time.parse('2023-12-31').localtime } let(:to) { Time.par...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/views/import_spec.rb
Ruby
mit
49
main
842
# frozen_string_literal: true RSpec.describe Dsu::Views::Import do subject(:import_view) { described_class.new(presenter: presenter, options: options) } let(:options) { { override: false } } let(:import_file_path) { 'spec/fixtures/files/import.csv' } let(:presenter) do Dsu::Presenters::Import::AllPresente...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/views/entry_group/edit_spec.rb
Ruby
mit
49
main
6,058
# frozen_string_literal: true RSpec.shared_examples 'the editor template shows no previous entries' do let(:expected_editor_template) do <<~TEMPLATE ENTER DSU ENTRIES BELOW TEMPLATE end it 'returns an editor template with no entries' do expect(edit_view.render_as_string).to include(expected_ed...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/views/project/delete_spec.rb
Ruby
mit
49
main
4,192
# frozen_string_literal: true RSpec.describe Dsu::Views::Project::Delete do subject(:delete_view) do described_class.new(presenter: presenter, options: options) end let(:options) { nil } let(:project_name) { 'xyz' } let(:project) { build(:project, project_name: project_name, options: options) } descr...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/views/project/use_by_number_spec.rb
Ruby
mit
49
main
5,267
# frozen_string_literal: true RSpec.describe Dsu::Views::Project::UseByNumber do subject(:use_by_number_view) do described_class.new(presenter: presenter, options: options) end before do stub_import_prompt(response: response) end let(:options) { nil } let(:project) { create(:project, project_name...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/views/project/use_spec.rb
Ruby
mit
49
main
4,667
# frozen_string_literal: true RSpec.describe Dsu::Views::Project::Use do subject(:use_view) do described_class.new(presenter: presenter, options: options) end before do stub_import_prompt(response: response) end let(:options) { nil } let(:project) { create(:project, project_name: 'xyz', options: ...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/views/project/create_spec.rb
Ruby
mit
49
main
3,507
# frozen_string_literal: true RSpec.describe Dsu::Views::Project::Create do subject(:create_view) do described_class.new(presenter: presenter, options: options) end before do stub_import_prompt(response: response) end let(:presenter) do build(:create_presenter, project_name: project_name, descr...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/views/project/delete_by_number_spec.rb
Ruby
mit
49
main
4,255
# frozen_string_literal: true RSpec.describe Dsu::Views::Project::DeleteByNumber do subject(:delete_by_number_view) do described_class.new(presenter: presenter, options: options) end shared_examples 'the project does not exist' do it 'does not exist' do expect(Dsu::Models::Project.exist?(project_n...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/views/project/rename_by_number_spec.rb
Ruby
mit
49
main
1,752
# frozen_string_literal: true # rubocop:disable RSpec/MultipleMemoizedHelpers RSpec.describe Dsu::Views::Project::RenameByNumber do subject(:rename_view) do described_class.new(presenter: presenter, options: options) end before do stub_import_prompt(response: response) end let(:options) { nil } l...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/views/project/list_spec.rb
Ruby
mit
49
main
1,475
# frozen_string_literal: true RSpec.describe Dsu::Views::Project::List do subject(:list_view) do described_class.new(presenter: presenter, options: options) end let(:presenter) do build(:list_presenter, options: options) end let(:options) { nil } describe '#initialize' do context 'when the ar...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/views/project/rename_spec.rb
Ruby
mit
49
main
1,589
# frozen_string_literal: true RSpec.describe Dsu::Views::Project::Rename do subject(:rename_view) do described_class.new(presenter: presenter, options: options) end before do stub_import_prompt(response: response) end let(:options) { nil } let(:response) { 'none' } let(:project) { default_proje...
github
gangelo/dsu
https://github.com/gangelo/dsu
spec/dsu/views/shared/message_spec.rb
Ruby
mit
49
main
2,720
# frozen_string_literal: true RSpec.describe Dsu::Views::Shared::Message do subject(:message) do described_class.new(messages: messages, message_type: message_type, options: options) end shared_examples 'the expecged output is sent to $stdout' do let(:output) do output = Dsu::Services::StdoutRedir...
github
plehoux/heybill
https://github.com/plehoux/heybill
heybill.gemspec
Ruby
mit
49
master
908
# Ensure we require the local version and not one we might have installed already require File.join([File.dirname(__FILE__),'lib','heybill','version.rb']) spec = Gem::Specification.new do |s| s.name = 'heybill' s.version = Heybill::VERSION s.author = 'Philippe-Antoine Lehoux' s.email = 'plehoux@gmail.com' s....
github
plehoux/heybill
https://github.com/plehoux/heybill
spec/spec_helper.rb
Ruby
mit
49
master
480
RSpec.configure do |config| config.before(:each) do ARGV.clear end def capture(stream) stream = stream.to_s captured_stream = Tempfile.new(stream) stream_io = eval("$#{stream}") origin_stream = stream_io.dup stream_io.reopen(captured_stream) yield stream_io.rewind return cap...
github
plehoux/heybill
https://github.com/plehoux/heybill
spec/lib/heybill/provider_spec.rb
Ruby
mit
49
master
3,668
require 'spec_helper' describe Heybill::Provider do subject { Heybill::Provider.new(from: 'june 2012', to: 'april 2013') } context '#initialize' do it 'initializes to, from & save_to with good type' do expect(subject.to).to be_an_instance_of Date expect(subject.from).to be_an_instance_of D...
github
plehoux/heybill
https://github.com/plehoux/heybill
spec/lib/heybill/fetch_spec.rb
Ruby
mit
49
master
716
require 'spec_helper' describe Heybill::Fetch do let(:fake_provider_class) { Class.new {def self.fetch(options); puts 'whatt' end} } before do stub_const('Heybill::Providers::Acme', fake_provider_class) Heybill::Provider.stub(:all).and_return([OpenStruct.new(name: 'acme')]) load './lib/heybill/fetc...
github
plehoux/heybill
https://github.com/plehoux/heybill
spec/lib/heybill/bill_spec.rb
Ruby
mit
49
master
268
require 'spec_helper' describe Heybill::Bill do subject { Heybill::Bill.new('Happy Xmas corp', Date.new(2012,12,25)) } context '#file_name' do it 'formats file name' do expect(subject.file_name).to eq '2012-12-25 Happy Xmas corp.pdf' end end end
github
plehoux/heybill
https://github.com/plehoux/heybill
spec/lib/heybill/cli_spec.rb
Ruby
mit
49
master
399
require 'spec_helper' describe Heybill::CLI do context '#providers' do let(:output) { capture(:stdout) { subject.providers } } it 'returns a list of all providers' do Heybill::Provider.stub(:all).and_return( 2.times.collect { |i| OpenStruct.new({name: "acme#{i}"}) } ) expect(output)...
github
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/bill.rb
Ruby
mit
49
master
202
module Heybill class Bill def initialize(provider, date) @provider = provider @date = date end def file_name "#{@date.strftime('%F')} #{@provider}.pdf" end end end