spec/cli/app_spec.rb in wojtekmach-cli-0.2.0 vs spec/cli/app_spec.rb in wojtekmach-cli-0.3.0

- old
+ new

@@ -19,22 +19,16 @@ puts options[:msg] || "Hello, World!" end end end - it "has a binary name" do - @app.binary.should eq("hello") - end + subject { @app } - it "has a name" do - @app.name.should eq("Hello") - end + its(:binary) { should eq("hello") } + its(:name) { should eq("Hello") } + its(:version) { should eq("0.0.1") } - it "has a version" do - @app.version.should eq("0.0.1") - end - it "runs an action" do $stdout.should_receive(:puts).with("Hi!") @app.run("hi") end @@ -78,28 +72,28 @@ end end end end - describe App, "a simple app" do + describe App, "with only default action" do before do @app = App.new("hello") do default do - puts args[0] + puts args.join(" ") end end end it "always runs the default action" do $stdout.should_receive(:puts).with("Hello, World!") @app.run!(["Hello, World!"]) - $stdout.should_receive(:puts).with("1") + $stdout.should_receive(:puts).with("1 2 3") @app.run!(%w(1 2 3)) end end - describe App, "blank app" do + describe App, "with no actions" do describe "run!" do it "should fail" do @app = App.new("blank") do end