spec/boty/cli_spec.rb in boty-0.2.0 vs spec/boty/cli_spec.rb in boty-1.0.0
- old
+ new
@@ -8,31 +8,34 @@
before(:all) do
FileUtils.mkdir_p "tmp" unless Dir.exist? "tmp"
FileUtils.chdir "tmp"
end
- before do
- FileUtils.rm_rf "nice_bot" if Dir.exist? "nice_bot"
-
- allow(cli).to receive(:ask)
- .and_return ENV["SLACK_COMPANY"], ENV["SLACK_BOT_API_TOKEN"]
-
- allow(cli).to receive(:run)
- end
-
after(:all) do
- FileUtils.rm_rf "nice_bot" if Dir.exist? "nice_bot"
FileUtils.chdir "../"
end
describe "#new PROJECT" do
def create_nice_bot
capture(:stdout) do
cli.new "nice_bot"
end
end
+ before do
+ FileUtils.rm_rf "nice_bot" if Dir.exist? "nice_bot"
+
+ allow(cli).to receive(:ask)
+ .and_return ENV["SLACK_COMPANY"], ENV["SLACK_BOT_API_TOKEN"]
+
+ allow(cli).to receive(:run)
+ end
+
+ after(:all) do
+ FileUtils.rm_rf "nice_bot"
+ end
+
it "creates a directory named after the PROJECT" do
expect { create_nice_bot }.to create_directory "nice_bot"
end
it "creates the executable" do
@@ -79,9 +82,25 @@
end
it "runs bundle install after create the project" do
expect(cli).to run "bundle install"
create_nice_bot
+ end
+ end
+
+ describe "#compile" do
+ before do
+ FileUtils.rm_rf "bin"
+ end
+
+ it "compiles the project/bot.tt onto bin/bot" do
+ expect(cli).to run "chmod +x bin/bot"
+
+ expect {
+ capture(:stdout) do
+ cli.compile
+ end
+ }.to create_file "bin/bot"
end
end
end
end