complete spec updates for RSpec 3 using only :expect syntax
This commit is contained in:
1 parent
5783ed993a
commit
31968e7e32
6 files changed
+61
-61
No files matched your search
@@ -6,9 +6,9 @@ module Rscons
|
||||
|
||||
it "supports overriding DISASM_CMD construction variable" do
|
||||
cache = "cache"
|
||||
cache.stub(:up_to_date?) { false }
|
||||
cache.stub(:mkdir_p) { }
|
||||
cache.stub(:register_build) { }
|
||||
allow(cache).to receive(:up_to_date?) { false }
|
||||
allow(cache).to receive(:mkdir_p) { }
|
||||
allow(cache).to receive(:register_build) { }
|
||||
expect(env).to receive(:execute).with("Disassemble a_file.txt", ["my_disasm", "a_file.exe"], anything).and_return(true)
|
||||
subject.run("a_file.txt", ["a_file.exe"], cache, env, "DISASM_CMD" => ["my_disasm", "${_SOURCES}"])
|
||||
end
|
||||
|
||||
@@ -6,11 +6,11 @@ module Rscons
|
||||
|
||||
it "supports overriding CCCMD construction variable" do
|
||||
cache = "cache"
|
||||
cache.stub(:up_to_date?) { false }
|
||||
cache.stub(:mkdir_p) { }
|
||||
cache.stub(:register_build) { }
|
||||
FileUtils.stub(:rm_f) { }
|
||||
File.stub(:exists?) { false }
|
||||
allow(cache).to receive(:up_to_date?) { false }
|
||||
allow(cache).to receive(:mkdir_p) { }
|
||||
allow(cache).to receive(:register_build) { }
|
||||
allow(FileUtils).to receive(:rm_f) { }
|
||||
allow(File).to receive(:exists?) { false }
|
||||
expect(env).to receive(:execute).with("CC mod.o", ["llc", "mod.c"]).and_return(true)
|
||||
subject.run("mod.o", ["mod.c"], cache, env, "CCCMD" => ["llc", "${_SOURCES}"])
|
||||
end
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
module Rscons
|
||||
describe Cache do
|
||||
before do
|
||||
File.stub(:read) { nil }
|
||||
allow(File).to receive(:read) { nil }
|
||||
end
|
||||
|
||||
def build_from(cache)
|
||||
JSON.stub(:load) do
|
||||
allow(JSON).to receive(:load) do
|
||||
cache
|
||||
end
|
||||
Cache.instance.tap do |cache|
|
||||
@@ -28,7 +28,7 @@ module Rscons
|
||||
describe "#clear" do
|
||||
it "removes the cache file" do
|
||||
expect(FileUtils).to receive(:rm_f).with(Cache::CACHE_FILE)
|
||||
JSON.stub(:load) {{}}
|
||||
allow(JSON).to receive(:load) {{}}
|
||||
Cache.instance.clear
|
||||
end
|
||||
end
|
||||
@@ -47,7 +47,7 @@ module Rscons
|
||||
describe "#up_to_date?" do
|
||||
empty_env = "env"
|
||||
before do
|
||||
empty_env.stub(:get_user_deps) { nil }
|
||||
allow(empty_env).to receive(:get_user_deps) { nil }
|
||||
end
|
||||
|
||||
it "returns false when target file does not exist" do
|
||||
|
||||
@@ -205,7 +205,7 @@ module Rscons
|
||||
cache = "cache"
|
||||
expect(Cache).to receive(:instance).and_return(cache)
|
||||
expect(cache).to receive(:clear_checksum_cache!)
|
||||
env.stub(:run_builder) do |builder, target, sources, cache, vars|
|
||||
allow(env).to receive(:run_builder) do |builder, target, sources, cache, vars|
|
||||
raise "Ruby exception thrown by builder"
|
||||
end
|
||||
expect(cache).to receive(:write)
|
||||
@@ -349,11 +349,11 @@ module Rscons
|
||||
build_op[:vars]["CFLAGS"] += ["-O3", "-DSPECIAL"]
|
||||
end
|
||||
end
|
||||
env.builders["Object"].stub(:run) do |target, sources, cache, env, vars|
|
||||
allow(env.builders["Object"]).to receive(:run) do |target, sources, cache, env, vars|
|
||||
expect(vars["CFLAGS"]).to eq []
|
||||
end
|
||||
env.run_builder(env.builders["Object"], "build/normal/module.o", ["src/normal/module.c"], "cache", {})
|
||||
env.builders["Object"].stub(:run) do |target, sources, cache, env, vars|
|
||||
allow(env.builders["Object"]).to receive(:run) do |target, sources, cache, env, vars|
|
||||
expect(vars["CFLAGS"]).to eq ["-O3", "-DSPECIAL"]
|
||||
end
|
||||
env.run_builder(env.builders["Object"], "build/special/module.o", ["src/special/module.c"], "cache", {})
|
||||
|
||||
Reference in new issue
Block a user