Skip to content

Commit

Permalink
Test files folder structure (#86)
Browse files Browse the repository at this point in the history
Aligned folder structure to Ruby on Rails convention. Added Rake task for running integration and system tests.
  • Loading branch information
natalia-ss authored Jan 22, 2024
1 parent 3eebcf7 commit 71298ce
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 26 deletions.
19 changes: 19 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,22 @@ desc 'Logs a warning'
task :log, [:message] do |_t, args|
RubyRaider::Logger.warn(args.message)
end

desc 'Runs integration tests'
task :integration, [:type, :name] do |_t, args|
path = args.type ? "spec/integration/#{args.type}" : 'spec/integration'
full_path = if args.type == 'generators' && args.name
"#{path}/#{args.name.downcase}_generator_spec.rb"
elsif args.type == 'commands' && args.name
"#{path}/#{args.name.downcase}_commands_spec.rb"
else
path
end

system "rspec #{full_path}"
end

desc 'Runs system tests'
task :system do |_t|
system 'rspec spec/system'
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# require 'fileutils'
# require 'pathname'
# require 'yaml'
# require_relative '../lib/generators/common_generator'
# require_relative '../lib/commands/open_ai_commands'
# require_relative '../lib/scaffolding/scaffolding'
# require_relative 'spec_helper'
# require_relative '../../../lib/generators/common_generator'
# require_relative '../../../lib/integration.commands/open_ai_commands'
# require_relative '../../../lib/scaffolding/scaffolding'
# require_relative '../../spec_helper'
#
# describe OpenAiCommands do
# let(:open_ai) { described_class }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require 'dotenv'
require 'pathname'
require 'yaml'
require_relative '../lib/generators/common_generator'
require_relative '../lib/commands/scaffolding_commands'
require_relative '../lib/scaffolding/scaffolding'
require_relative 'spec_helper'
require_relative '../../../lib/generators/common_generator'
require_relative '../../../lib/commands/scaffolding_commands'
require_relative '../../../lib/scaffolding/scaffolding'
require_relative '../../spec_helper'

describe ScaffoldingCommands do
let(:scaffold) { described_class }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
require 'fileutils'
require 'pathname'
require 'yaml'
require_relative '../lib/generators/common_generator'
require_relative '../lib/commands/utility_commands'
require_relative '../lib/scaffolding/scaffolding'
require_relative 'spec_helper'
require_relative '../../../lib/generators/common_generator'
require_relative '../../../lib/commands/utility_commands'
require_relative '../../../lib/scaffolding/scaffolding'
require_relative '../../spec_helper'

describe UtilityCommands do
let(:utility) { described_class }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative '../lib/generators/actions/actions_generator'
require_relative 'spec_helper'
require_relative '../../../lib/generators/actions/actions_generator'
require_relative '../../spec_helper'

describe ActionsGenerator do
shared_examples 'creates web automation framework' do |name|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative '../lib/generators/automation/automation_generator'
require_relative 'spec_helper'
require_relative '../../../lib/generators/automation/automation_generator'
require_relative '../../spec_helper'

describe AutomationGenerator do
shared_examples 'creates web automation framework' do |name|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative '../lib/generators/common_generator'
require_relative 'spec_helper'
require_relative '../../../lib/generators/common_generator'
require_relative '../../spec_helper'

describe CommonGenerator do
shared_examples 'creates common files' do |name|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative '../lib/generators/cucumber/cucumber_generator'
require_relative 'spec_helper'
require_relative '../../../lib/generators/cucumber/cucumber_generator'
require_relative '../../spec_helper'

describe CucumberGenerator do
shared_examples 'creates cucumber files' do |project_name, file_name|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative '../lib/generators/helper_generator'
require_relative 'spec_helper'
require_relative '../../../lib/generators/helper_generator'
require_relative '../../spec_helper'

describe HelpersGenerator do
shared_examples 'creates common helpers' do |name|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative '../lib/generators/rspec/rspec_generator'
require_relative 'spec_helper'
require_relative '../../../lib/generators/rspec/rspec_generator'
require_relative '../../spec_helper'

describe RspecGenerator do
shared_examples 'creates factory files' do |project_name|
Expand Down
4 changes: 2 additions & 2 deletions spec/ruby_raider_spec.rb → spec/system/ruby_raider_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'fileutils'
require_relative 'spec_helper'
require_relative '../lib/ruby_raider'
require_relative '../spec_helper'
require_relative '../../lib/ruby_raider'

describe RubyRaider do
shared_examples 'execute web frameworks' do |name|
Expand Down

0 comments on commit 71298ce

Please sign in to comment.