Sha256: 2f6c5772dc12d7c737f56f72c8a5808c50d0beb23c7e34b5c87e16cdfd491a80
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require "spec_helper" describe Findable::Associations::Utils do let(:utils) { Findable::Associations::Utils } describe "#model_for" do include_context "FindableModels" let(:model_name) { findable_model.model_name } it { expect(utils.model_for(model_name.singular)).to eq(findable_model) } it { expect(utils.model_for(model_name.plural, collection: true)).to eq(findable_model) } it { expect(utils.model_for("invalid", class_name: model_name.name)).to eq(findable_model) } it { expect { utils.model_for("invalid") }.to raise_error } it { expect { utils.model_for("invalid", safe: true) }.not_to raise_error } it { expect(utils.model_for("invalid", safe: true)).to be_nil } end describe "#parse_args" do let(:parsed_args) { [:some_name, {class_name: "SomeClass"}] } let(:args) { [parsed_args.first, **parsed_args.last] } it { expect(utils.parse_args(args)).to eq(parsed_args) } it { expect { utils.parse_args(args) }.not_to change { args } } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
findable-0.1.1 | spec/findable/associations/utils_spec.rb |