Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test that the plugin test passes #3

Merged
merged 1 commit into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/hello_world/README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
= hello_world

Description goes here
2 changes: 2 additions & 0 deletions .github/hello_world/app/models/hello.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Hello < ActiveRecord::Base
end
3 changes: 3 additions & 0 deletions .github/hello_world/config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# English strings go here for Rails i18n
en:
# my_label: "My label"
2 changes: 2 additions & 0 deletions .github/hello_world/config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Plugin's routes
# See: http://guides.rubyonrails.org/routing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class CreateHellos < ActiveRecord::Migration[6.1]
def change
create_table :hellos do |t|
t.string :world
end
end
end
8 changes: 8 additions & 0 deletions .github/hello_world/init.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Redmine::Plugin.register :hello_world do
name 'Hello World'
author 'Author name'
description 'This is a plugin for Redmine'
version '0.0.1'
url 'http://example.com/path/to/plugin'
author_url 'http://example.com/about'
end
2 changes: 2 additions & 0 deletions .github/hello_world/test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Load the Redmine helper
require_relative '../../../test/test_helper'
8 changes: 8 additions & 0 deletions .github/hello_world/test/unit/hello_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require_relative '../test_helper'

class HelloTest < ActiveSupport::TestCase
def test_world
Hello.create world: "Redmine"
assert_equal "Redmine", Hello.first.world
end
end
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,22 @@ jobs:
database: ${{ matrix.redmine-database }}
ruby-version: ${{ matrix.ruby-version }}

- name: Install a plugin for testing
run: |
cp -R ../.github/hello_world plugins/
bin/rails redmine:plugins:migrate
working-directory: ${{ env.REDMINE_SRC }}

- run: |
about=$(bin/rails r "require 'redmine/version'; puts Redmine::Info.environment")
echo "$about"
echo "$about" | grep "${{ matrix.expected-about-db-adapter }}"
echo "$about" | grep "${{ matrix.expected-about-redmine-version }}"
echo "$about" | grep "hello_world"
working-directory: ${{ env.REDMINE_SRC }}

- run: |
bin/rails test test/unit/news_test.rb
bin/rails test test/system/my_page_test.rb
bin/rails redmine:plugins:test
working-directory: ${{ env.REDMINE_SRC }}