redmine_extensions 0.2.12 → 0.2.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/redmine_extensions/entity/templates/controller_spec.rb.erb +3 -3
- data/lib/generators/redmine_extensions/entity/templates/factories.rb.erb +1 -1
- data/lib/generators/redmine_extensions/plugin/templates/after_init.rb.erb +1 -1
- data/lib/redmine_extensions/version.rb +1 -1
- data/spec/factories/easy_queries.rb +1 -1
- data/spec/factories/easy_settings.rb +1 -1
- data/spec/factories/issues.rb +5 -5
- data/spec/factories/projects.rb +12 -12
- data/spec/factories/time_entries.rb +1 -1
- data/spec/factories/trackers.rb +2 -2
- data/spec/factories/users.rb +1 -1
- data/spec/models/easy_setting_spec.rb +1 -1
- data/spec/presenters/{redmine_extensions/easy_setting_presenter_spec.rb → easy_settings/params_wrapper_spec.rb} +7 -7
- data/spec/rails_helper.rb +8 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f84dc4261d345f5b0bfc2bea6f7dfef762d7bf31
|
4
|
+
data.tar.gz: c872ccac1093e94cd5e0831279277ce3312b0ad4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c660a03ba12d7ad159f5818d2dbf0d5a9425181e9b24113fc99ce35d997b071801aa74984fb3f2d1b5d37308ce20f25b43ff5563961628566dc874cdfb9a88b9
|
7
|
+
data.tar.gz: 1404b7ee3c6132c4a8e6d147345cda6db61d9e843f52b06d0c696cf6b62ca34905ca65a0e8b6e8bd5a2ce094d571990903db4c8a83ed62daa72f87d8d662b47e
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require Rails.root.join('plugins', 'easyproject', 'easy_plugins', 'easy_extensions/test/spec/spec_helper')
|
2
2
|
|
3
3
|
describe <%= controller_class %>Controller, logged: true do
|
4
|
-
let(:<%= model_name_underscored %>) {
|
5
|
-
let(:<%= model_name_pluralize_underscored %>) {
|
4
|
+
let(:<%= model_name_underscored %>) { FactoryBot.create(:<%= model_name_underscored %>) }
|
5
|
+
let(:<%= model_name_pluralize_underscored %>) { FactoryBot.create_list(:<%= model_name_underscored %>, 5) }
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
role = Role.non_member
|
@@ -40,7 +40,7 @@ describe <%= controller_class %>Controller, logged: true do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'create with valid' do
|
43
|
-
post :create, {<%= model_name_underscored %>:
|
43
|
+
post :create, {<%= model_name_underscored %>: FactoryBot.attributes_for(:<%= model_name_underscored %>)}
|
44
44
|
expect(response).to have_http_status(:success)
|
45
45
|
expect(assigns[:<%= model_name_underscored %>]).not_to be_a_new(<%= model_name %>)
|
46
46
|
expect(response).to redirect_to(<%= model_name_underscored %>_path(assigns[:<%= model_name_underscored %>]))
|
@@ -18,6 +18,6 @@ end
|
|
18
18
|
# in this block should be used require_dependency, but only if necessary.
|
19
19
|
# better is to place a class in file named by rails naming convency and let it be loaded automatically
|
20
20
|
# Here goes query registering, custom fields registering and so on
|
21
|
-
|
21
|
+
RedmineExtensions::Reloader.to_prepare do
|
22
22
|
|
23
23
|
end
|
data/spec/factories/issues.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
|
3
3
|
factory :enumeration do
|
4
4
|
name 'TestEnum'
|
@@ -41,7 +41,7 @@ FactoryGirl.define do
|
|
41
41
|
start_date { Date.today }
|
42
42
|
due_date { Date.today + 7.days }
|
43
43
|
status { tracker.default_status }
|
44
|
-
priority { IssuePriority.default ||
|
44
|
+
priority { IssuePriority.default || FactoryBot.create(:issue_priority, :default) }
|
45
45
|
association :author, :factory => :user, :firstname => "Author"
|
46
46
|
association :assigned_to, :factory => :user, :firstname => "Assignee"
|
47
47
|
|
@@ -65,7 +65,7 @@ FactoryGirl.define do
|
|
65
65
|
|
66
66
|
trait :with_journals do
|
67
67
|
after(:create) do |issue|
|
68
|
-
|
68
|
+
FactoryBot.create_list(:journal, 2, issue: issue, journalized_type: 'Issue')
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -75,7 +75,7 @@ FactoryGirl.define do
|
|
75
75
|
|
76
76
|
trait :with_attachment do
|
77
77
|
after(:create) do |issue|
|
78
|
-
|
78
|
+
FactoryBot.create_list(:attachment, 1, container: issue)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -83,7 +83,7 @@ FactoryGirl.define do
|
|
83
83
|
|
84
84
|
after :build do |issue, evaluator|
|
85
85
|
if evaluator.factory_is_child
|
86
|
-
issue.parent_issue_id =
|
86
|
+
issue.parent_issue_id = FactoryBot.create(:issue, :project => issue.project).id
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
data/spec/factories/projects.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :project do
|
3
3
|
transient do
|
4
|
-
number_of_issues
|
4
|
+
number_of_issues 0
|
5
5
|
number_of_members 0
|
6
6
|
number_of_issue_categories 2
|
7
7
|
number_of_subprojects 0
|
@@ -12,24 +12,24 @@ FactoryGirl.define do
|
|
12
12
|
end
|
13
13
|
# name 'Test project'
|
14
14
|
sequence(:name){ |n| "Project ##{n}" }
|
15
|
-
identifier {
|
15
|
+
sequence(:identifier){ |n| "#{name.parameterize}#{n}" }
|
16
16
|
|
17
17
|
after(:create) do |project, evaluator|
|
18
18
|
trackers = Array.wrap(evaluator.trackers)
|
19
19
|
trackers = Tracker.all.to_a if trackers.empty?
|
20
|
-
trackers.concat( [
|
20
|
+
trackers.concat( [FactoryBot.create(:tracker), FactoryBot.create(:bug_tracker)] ) if evaluator.create_trackers || trackers.empty?
|
21
21
|
project.trackers = trackers
|
22
|
-
project.time_entry_activities = [
|
22
|
+
project.time_entry_activities = [FactoryBot.create(:time_entry_activity)]
|
23
23
|
end
|
24
24
|
after :create do |project, evaluator|
|
25
|
-
|
26
|
-
|
25
|
+
FactoryBot.create_list :issue, evaluator.number_of_issues, :project => project
|
26
|
+
FactoryBot.create_list :member, evaluator.number_of_members, :project => project, :roles => [FactoryBot.create(:role)]
|
27
27
|
project.enabled_module_names += evaluator.add_modules
|
28
28
|
end
|
29
29
|
|
30
30
|
after :create do |project, evaluator|
|
31
31
|
evaluator.members.each do |user|
|
32
|
-
|
32
|
+
FactoryBot.create(:member, project: project, user: user)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -39,19 +39,19 @@ FactoryGirl.define do
|
|
39
39
|
milestone_options Hash.new
|
40
40
|
end
|
41
41
|
after :create do |project, evaluator|
|
42
|
-
|
42
|
+
FactoryBot.create_list :version, evaluator.number_of_versions, evaluator.milestone_options.merge( :project => project )
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
trait :with_subprojects do
|
47
47
|
after :create do |project, evaluator|
|
48
|
-
|
48
|
+
FactoryBot.create_list :project, evaluator.number_of_subprojects, :parent => project
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
trait :with_categories do
|
53
53
|
after :create do |project, evaluator|
|
54
|
-
|
54
|
+
FactoryBot.create_list :issue_category, evaluator.number_of_issue_categories, :project => project
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -71,7 +71,7 @@ FactoryGirl.define do
|
|
71
71
|
user
|
72
72
|
|
73
73
|
after :build do |member, evaluator|
|
74
|
-
member.member_roles <<
|
74
|
+
member.member_roles << FactoryBot.build(:member_role, member: member)
|
75
75
|
end
|
76
76
|
|
77
77
|
trait :without_roles do
|
data/spec/factories/trackers.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
|
3
3
|
factory :tracker do
|
4
4
|
sequence(:name) {|n| "Feature ##{n}"}
|
5
5
|
|
6
|
-
default_status { IssueStatus.first ||
|
6
|
+
default_status { IssueStatus.first || FactoryBot.create(:issue_status) }
|
7
7
|
|
8
8
|
trait :bug do
|
9
9
|
sequence(:name) {|n| "Bug ##{n}"}
|
data/spec/factories/users.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rails_helper'
|
|
2
2
|
|
3
3
|
RSpec.describe EasySetting, type: :model do
|
4
4
|
|
5
|
-
let(:project) {
|
5
|
+
let(:project) { FactoryBot.create(:project, name: 'My project') }
|
6
6
|
let!(:easy_setting) { EasySetting.create(name: 'my_setting', value: 'my_value', project_id: project.id) }
|
7
7
|
let!(:easy_setting_global) { EasySetting.create(name: 'my_setting', value: 'my_value_global') }
|
8
8
|
|
@@ -1,20 +1,20 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
module
|
4
|
-
RSpec.describe
|
3
|
+
module EasySettings
|
4
|
+
RSpec.describe ParamsWrapper, clear_cache: true do
|
5
5
|
|
6
|
-
let(:project) {
|
6
|
+
let(:project) { FactoryBot.create(:project) }
|
7
7
|
|
8
8
|
describe 'saving values' do
|
9
9
|
it 'create easy_setting' do
|
10
|
-
presenter =
|
10
|
+
presenter = EasySettings::ParamsWrapper.from_params({'key' => 'value', 'key2' => 'value2'})
|
11
11
|
expect{ presenter.save }.to change(EasySetting, :count).by(2)
|
12
12
|
expect( EasySetting.find_by(name: 'key').value ).to eq('value')
|
13
13
|
expect( EasySetting.value('key') ).to eq('value')
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'create project setting' do
|
17
|
-
presenter =
|
17
|
+
presenter = EasySettings::ParamsWrapper.from_params({'key' => 'value', 'key2' => 'value2'}, project: project)
|
18
18
|
expect{ presenter.save }.to change(EasySetting, :count).by(2)
|
19
19
|
expect( EasySetting.where(project_id: project.id).count ).to eq(2)
|
20
20
|
expect( EasySetting.value('key') ).to eq(nil)
|
@@ -22,8 +22,8 @@ module RedmineExtensions
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'format value' do
|
25
|
-
|
26
|
-
|
25
|
+
EasySetting.map.boolean_keys(:key, :key2)
|
26
|
+
presenter = EasySettings::ParamsWrapper.from_params({'key' => '1', 'key2' => '0'})
|
27
27
|
presenter.save
|
28
28
|
expect(EasySetting.value('key')).to be true
|
29
29
|
expect(EasySetting.value('key2')).to be false
|
data/spec/rails_helper.rb
CHANGED
@@ -5,7 +5,7 @@ require 'spec_helper'
|
|
5
5
|
require File.expand_path("../redmine/config/environment.rb", __FILE__)
|
6
6
|
# Add additional requires below this line. Rails is not loaded until this point!
|
7
7
|
require 'rspec/rails'
|
8
|
-
require '
|
8
|
+
require 'factory_bot_rails'
|
9
9
|
require 'database_cleaner'
|
10
10
|
|
11
11
|
Rails.backtrace_cleaner.remove_silencers!
|
@@ -63,7 +63,13 @@ Capybara.register_driver :poltergeist do |app|
|
|
63
63
|
end
|
64
64
|
|
65
65
|
Capybara.register_driver :chrome do |app|
|
66
|
-
|
66
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
67
|
+
'chromeOptions' => {
|
68
|
+
'args' => ENV['CHROME_OPTIONS'].to_s.split(' ')
|
69
|
+
}
|
70
|
+
)
|
71
|
+
|
72
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
|
67
73
|
end
|
68
74
|
|
69
75
|
Capybara.javascript_driver = ENV['JS_DRIVER'].present? ? ENV['JS_DRIVER'].downcase.to_sym : :poltergeist
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmine_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Easy Software Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
requirements:
|
85
85
|
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version:
|
87
|
+
version: 3.3.1
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
92
|
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
94
|
+
version: 3.3.1
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
|
-
name:
|
96
|
+
name: factory_bot_rails
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
99
|
- - "~>"
|
@@ -280,7 +280,7 @@ files:
|
|
280
280
|
- spec/factories/users.rb
|
281
281
|
- spec/features/autocomplete_spec.rb
|
282
282
|
- spec/models/easy_setting_spec.rb
|
283
|
-
- spec/presenters/
|
283
|
+
- spec/presenters/easy_settings/params_wrapper_spec.rb
|
284
284
|
- spec/rails_helper.rb
|
285
285
|
- spec/spec_helper.rb
|
286
286
|
- spec/support/plugin_generator.rb
|
@@ -319,7 +319,7 @@ test_files:
|
|
319
319
|
- spec/factories/users.rb
|
320
320
|
- spec/features/autocomplete_spec.rb
|
321
321
|
- spec/models/easy_setting_spec.rb
|
322
|
-
- spec/presenters/
|
322
|
+
- spec/presenters/easy_settings/params_wrapper_spec.rb
|
323
323
|
- spec/rails_helper.rb
|
324
324
|
- spec/spec_helper.rb
|
325
325
|
- spec/support/plugin_generator.rb
|