spec/interactor/rails_spec.rb in interactor-rails-2.2.0 vs spec/interactor/rails_spec.rb in interactor-rails-2.2.1

- old
+ new

@@ -4,11 +4,11 @@ # Account for older versions of Aruba as required by Rails 3.0 Aruba::Api.method_defined?(:last_command_started) ? super : last_command end before do - run_simple <<-CMD + run_command_and_stop <<-CMD bundle exec rails new example \ --skip-yarn \ --skip-gemfile \ --skip-git \ --skip-keeps \ @@ -32,17 +32,17 @@ cd "example" write_file "Gemfile", <<-EOF gem "rails" gem "interactor-rails", path: "#{ROOT}" EOF - run_simple "bundle install" + run_command_and_stop "bundle install" end context "rails generate" do context "interactor" do it "generates an interactor and spec" do - run_simple "bundle exec rails generate interactor place_order" + run_command_and_stop "bundle exec rails generate interactor place_order" path = "app/interactors/place_order.rb" expect(path).to be_an_existing_file expect(path).to have_file_content(<<-EOF) class PlaceOrder @@ -66,18 +66,18 @@ end EOF end it "requires a name" do - run_simple "bundle exec rails generate interactor" + run_command_and_stop "bundle exec rails generate interactor" expect("app/interactors/place_order.rb").not_to be_an_existing_file expect(last_command_started.stdout).to include("rails generate interactor NAME") end it "handles namespacing" do - run_simple "bundle exec rails generate interactor invoice/place_order" + run_command_and_stop "bundle exec rails generate interactor invoice/place_order" path = "app/interactors/invoice/place_order.rb" expect(path).to be_an_existing_file expect(path).to have_file_content(<<-EOF) class Invoice::PlaceOrder @@ -103,11 +103,11 @@ end end context "interactor:organizer" do it "generates an organizer" do - run_simple <<-CMD + run_command_and_stop <<-CMD bundle exec rails generate interactor:organizer place_order CMD path = "app/interactors/place_order.rb" expect(path).to be_an_existing_file @@ -131,11 +131,11 @@ end EOF end it "generates an organizer with interactors" do - run_simple <<-CMD + run_command_and_stop <<-CMD bundle exec rails generate interactor:organizer place_order \ charge_card fulfill_order CMD path = "app/interactors/place_order.rb" @@ -148,18 +148,18 @@ end EOF end it "requires a name" do - run_simple "bundle exec rails generate interactor:organizer" + run_command_and_stop "bundle exec rails generate interactor:organizer" expect("app/interactors/place_order.rb").not_to be_an_existing_file expect(last_command_started.stdout).to include("rails generate interactor:organizer NAME") end it "handles namespacing" do - run_simple "bundle exec rails generate interactor:organizer invoice/place_order" + run_command_and_stop "bundle exec rails generate interactor:organizer invoice/place_order" path = "app/interactors/invoice/place_order.rb" expect(path).to be_an_existing_file expect(path).to have_file_content(<<-EOF) class Invoice::PlaceOrder @@ -183,17 +183,17 @@ end end end it "auto-loads interactors" do - run_simple "bundle exec rails generate interactor place_order" + run_command_and_stop "bundle exec rails generate interactor place_order" - run_simple "bundle exec rails runner PlaceOrder" + run_command_and_stop "bundle exec rails runner PlaceOrder" end it "auto-loads organizers" do - run_simple "bundle exec rails generate interactor:organizer place_order" + run_command_and_stop "bundle exec rails generate interactor:organizer place_order" - run_simple "bundle exec rails runner PlaceOrder" + run_command_and_stop "bundle exec rails runner PlaceOrder" end end end