Skip to content

Commit

Permalink
add specs
Browse files Browse the repository at this point in the history
  • Loading branch information
i2bskn committed Aug 30, 2013
1 parent fc2ca57 commit 2508991
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions spec/mycmd/clis/settings_commands_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,36 @@

describe "#memories" do
let(:args){["memories"]}
before {Mycmd::Configuration.stub(:get_variables).and_return(create_variables)}

it "returns expected threads" do
Mycmd::Configuration.stub(:get_variables).and_return(create_variables)
after do
expect(
capture(:stdout) {
Mycmd::SettingsCommands.start(args)
}
).not_to be_nil
end

it "should call Configuration.#get_variables" do
Mycmd::Configuration.should_receive(:get_variables).and_return(create_variables)
end

it "should call SettingsCommands#create_result_variables" do
Mycmd::Printer.stub(:new).and_return(double.as_null_object)
Mycmd::SettingsCommands.any_instance.should_receive(:create_result_variables).exactly(2).and_return([["key", "varue"], 310378496])
end

it "should call SettingsCommands#expected_memory_used" do
Mycmd::Printer.stub(:new).and_return(double.as_null_object)
Mycmd::SettingsCommands.any_instance.should_receive(:expected_memory_used).and_return([["key", "varue"], ["key", "value"]])
end

it "should call Printer.#print_title" do
Mycmd::Printer.should_receive(:print_title).exactly(3)
end

it "should create Printer object" do
Mycmd::Printer.should_receive(:new).exactly(3).and_return(double.as_null_object)
end
end
end

0 comments on commit 2508991

Please sign in to comment.