spec/tasks/helpers_spec.rb in alchemy_cms-3.2.0.rc1 vs spec/tasks/helpers_spec.rb in alchemy_cms-3.2.0
- old
+ new
@@ -6,25 +6,31 @@
class Foo
extend Tasks::Helpers
end
describe "Tasks:Helpers" do
-
let(:config) do
- {
- 'test' => {
+ { 'test' => {
'adapter' => 'mysql2',
'username' => 'testuser',
'password' => '123456',
'host' => 'localhost'
}
}
end
before do
- allow(File).to receive(:exists?).and_return( true)
- allow(YAML).to receive(:load_file).and_return(config)
+ allow(File).to receive(:exists?) { true }
+ allow(File).to receive(:read) do
+<<-END
+test:
+ adapter: mysql2
+ username: testuser
+ password: "123456"
+ host: localhost
+END
+ end
end
describe "#database_dump_command" do
subject { Foo.database_dump_command(adapter) }
@@ -66,11 +72,11 @@
it { is_expected.not_to include("--host=") }
end
context "and the host is anything but not localhost" do
before do
- allow(YAML).to receive(:load_file).and_return({'test' => {'host' => 'mydomain.com'}})
+ allow(File).to receive(:read).and_return("test:\n host: mydomain.com")
end
it { is_expected.to include("--host='mydomain.com'") }
end
end
end
@@ -95,11 +101,11 @@
it { is_expected.not_to include("--host=") }
end
context "and the host is anything but not localhost" do
before do
- allow(YAML).to receive(:load_file).and_return({'test' => {'host' => 'mydomain.com'}})
+ allow(File).to receive(:read).and_return("test:\n host: mydomain.com")
end
it { is_expected.to include("--host='mydomain.com'") }
end
end
end
@@ -150,11 +156,11 @@
it { is_expected.not_to include("--host=") }
end
context "and the host is anything but not localhost" do
before do
- allow(YAML).to receive(:load_file).and_return({'test' => {'host' => 'mydomain.com'}})
+ allow(File).to receive(:read).and_return("test:\n host: mydomain.com")
end
it { is_expected.to include("--host='mydomain.com'") }
end
end
end
@@ -179,10 +185,10 @@
it { is_expected.not_to include("--host=") }
end
context "and the host is anything but not localhost" do
before do
- allow(YAML).to receive(:load_file).and_return({'test' => {'host' => 'mydomain.com'}})
+ allow(File).to receive(:read).and_return("test:\n host: mydomain.com")
end
it { is_expected.to include("--host='mydomain.com'") }
end
end
end