spec/interactor/rails_spec.rb in interactor-rails-2.0.0 vs spec/interactor/rails_spec.rb in interactor-rails-2.0.1

- old
+ new

@@ -45,10 +45,26 @@ run_simple "bundle exec rails generate interactor" check_file_presence(["app/interactors/place_order.rb"], false) assert_partial_output("rails generate interactor NAME", all_stdout) end + + it "handles namespacing" do + run_simple "bundle exec rails generate interactor invoice/place_order" + + path = "app/interactors/invoice/place_order.rb" + check_file_presence([path], true) + check_exact_file_content(path, <<-EOF) +class Invoice::PlaceOrder + include Interactor + + def call + # TODO + end +end +EOF + end end context "interactor:organizer" do it "generates an organizer" do run_simple <<-CMD @@ -86,9 +102,23 @@ it "requires a name" do run_simple "bundle exec rails generate interactor:organizer" check_file_presence(["app/interactors/place_order.rb"], false) assert_partial_output("rails generate interactor:organizer NAME", all_stdout) + end + + it "handles namespacing" do + run_simple "bundle exec rails generate interactor:organizer invoice/place_order" + + path = "app/interactors/invoice/place_order.rb" + check_file_presence([path], true) + check_exact_file_content(path, <<-EOF) +class Invoice::PlaceOrder + include Interactor::Organizer + + # organize Interactor1, Interactor2 +end +EOF end end end it "auto-loads interactors" do