Sha256: 93575516da3076f81a42e453830b6da86bb24b3846b4e8b2fd1135c89894f04c
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
module DT RSpec.describe Config do use_custom_let(:let_a, :attrs) let(:instance) { described_class.new(attrs) } subject { instance.send(m) } describe "#env" do let_m it { is_expected.to eq ENV.to_h } end describe "#rails" do let_m let_a(:rails) # NOTE: We can't reliably test for constant probing since `defined?` is a language keyword. context_when rails: :signature do it { is_expected.to eq :signature } end end describe "#root_path" do let_m let(:pathname_double) { double "Pathname(raw_path)" } let_a(:env) let_a(:rails) before :each do expect(instance).to receive(:Pathname).with(raw_path).once.and_return(pathname_double) expect(pathname_double).to receive(:realpath).once.and_return(:signature) end context "when Rails" do let(:raw_path) { Pathname("/path/to/project") } let_a(:rails) { double "rails" } it do expect(rails).to receive(:root).once.and_return(raw_path) is_expected.to eq :signature end end context_when rails: nil do context do let(:bundle_gemfile) { self.class.bundle_gemfile } let(:raw_path) { self.class.raw_path } define_singleton_method(:raw_path) { "/path/to/project" } define_singleton_method(:bundle_gemfile) { "#{raw_path}/Gemfile"} context_when env: {"BUNDLE_GEMFILE" => bundle_gemfile } do it { is_expected.to eq :signature } end end context_when env: {} do let(:raw_path) { Dir.pwd } it do subject end end end end # describe "#root_path" describe "#root_path=" do let_a(:root_path) subject { instance.root_path } context_when root_path: "/some/path" do it { is_expected.to eq Pathname("/some/path") } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_dt-1.2.0 | spec/lib/dt/config_spec.rb |