agilibox 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c492625f29e6a413965c9744b23a8de2cdc9a2b7
4
- data.tar.gz: 2aa12b3967dfd2ac0c6c7ec4f2cb1057536b52ee
3
+ metadata.gz: 20fcca2b5201c53d3f802a6f7f15ffca3f7608cb
4
+ data.tar.gz: 0a702db94cc91ee87ace2ccad257bf06515e51d7
5
5
  SHA512:
6
- metadata.gz: f8ebd6d3948bffa2af483a9e8ecff2db6dcfc7da7afcb6ecbefb40cf719e94f2ecf723a6e041383e3272dac291abc0af56ad3819ed96189227fa7bffc79fa65e
7
- data.tar.gz: 03fd5d1a9fc8de1267bb830c11dcc08665335a48595797f8fd782ba93d77111a19c20880a46929a7b7994a790f678e10b9f6fa41c9c262172dedbd0002366ad0
6
+ metadata.gz: b18adbe0b470c0bc4eb45e19f1f3d913ef803d8fc739f0165dc14c32f3e3396713f3d8fda68321c9b15267b56f42a828eec4e52681894b8822bfc94662fa1238
7
+ data.tar.gz: '09c491b370d5d5355b98f74cd4eea1ea2be2255b5fe14803eba1c0cd574152a812edb4c38a3438bb443c60d54c0f5ce727d015af37c924a0f02c000fce681d36'
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## 1.0.9
6
+
7
+ - Fix Model#tv
8
+ - Add cucumber helpers
9
+
5
10
  ## 1.0.8
6
11
 
7
12
  - Serializers improvements
@@ -12,7 +12,7 @@ module Agilibox::ModelI18n
12
12
  def tv(attribute)
13
13
  key = attribute
14
14
  value = public_send(attribute)
15
- t("#{key}.#{value}")
15
+ t("#{key}.#{value}") if value.present?
16
16
  end
17
17
 
18
18
  class_methods do
@@ -0,0 +1,8 @@
1
+ <%
2
+ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
+ rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
+ std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
5
+ %>
6
+ default: <%= std_opts %> features
7
+ wip: --tags @wip:3 --wip features
8
+ rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
@@ -0,0 +1,18 @@
1
+ module CapybaraWaitAjaxRequests
2
+ def wait_ajax_requests(timeout = Capybara.default_max_wait_time)
3
+ Timeout.timeout(timeout) do
4
+ sleep 0.1 until all_ajax_requests_finished?
5
+ end
6
+ end
7
+
8
+ def all_ajax_requests_finished?
9
+ page.evaluate_script("jQuery.active").zero?
10
+ end
11
+ end
12
+
13
+ World(CapybaraWaitAjaxRequests)
14
+
15
+ # Auto wait ajax request between steps
16
+ AfterStep do |_scenario|
17
+ wait_ajax_requests if page.evaluate_script("typeof jQuery") != "undefined"
18
+ end
@@ -0,0 +1,8 @@
1
+ require "database_cleaner"
2
+
3
+ Cucumber::Rails::Database.autorun_database_cleaner = false
4
+ Cucumber::Rails::Database.javascript_strategy = :truncation
5
+
6
+ After do |_scenario, _block|
7
+ DatabaseCleaner.clean_with(:truncation, except: Agilibox::CucumberConfig.databasecleaner_tables)
8
+ end
@@ -0,0 +1,3 @@
1
+ ENV["RAILS_ROOT"] ||= File.expand_path("../../../spec/dummy", __FILE__)
2
+ require "cucumber/rails"
3
+ require "agilibox/cucumber_config"
@@ -0,0 +1 @@
1
+ World(FactoryBot::Syntax::Methods)
@@ -0,0 +1,9 @@
1
+ # https://github.com/ariya/phantomjs/issues/13677
2
+
3
+ module RackETagDisable
4
+ def call(env)
5
+ @app.call(env)
6
+ end
7
+ end
8
+
9
+ Rack::ETag.send(:prepend, RackETagDisable)
@@ -0,0 +1,21 @@
1
+ require "capybara/poltergeist"
2
+
3
+ phantomjs_version = Agilibox::CucumberConfig.phantomjs_version
4
+ phantomjs_binary = `which phantomjs-#{phantomjs_version} phantomjs`.split("\n").first
5
+ raise "invalid phantomjs version" if `#{phantomjs_binary} -v`.strip != phantomjs_version
6
+ # You can download phantomjs here : https://bitbucket.org/ariya/phantomjs/downloads/
7
+ # Semaphore setup commmand : change-phantomjs-version 2.1.1
8
+
9
+ Capybara.register_driver :poltergeist do |app|
10
+ Capybara::Poltergeist::Driver.new(app,
11
+ :debug => false,
12
+ :window_size => Agilibox::CucumberConfig.phantomjs_window_size,
13
+ :timeout => 60,
14
+ :phantomjs => phantomjs_binary,
15
+ )
16
+ end
17
+
18
+ Capybara.default_driver = :poltergeist
19
+ Capybara.javascript_driver = :poltergeist
20
+ Capybara.current_driver = :poltergeist
21
+ Capybara.default_max_wait_time = 3
@@ -0,0 +1 @@
1
+ ActionController::Base.allow_rescue = false
@@ -0,0 +1,6 @@
1
+ # mocks
2
+ require "cucumber/rspec/doubles"
3
+
4
+ # wait_for { ... }.to eq(...)
5
+ require "rspec/wait"
6
+ World(RSpec::Wait)
@@ -0,0 +1,3 @@
1
+ After do |scenario|
2
+ page.save_screenshot(scenario.name.parameterize + ".png") if scenario.failed?
3
+ end
@@ -0,0 +1,10 @@
1
+ module CapybaraSelect2
2
+ def select2(selector, query, label = query)
3
+ selector = "##{selector}" if selector.is_a?(Symbol)
4
+ find("#{selector} + .select2-container").click
5
+ find(".select2-search__field").set(query.to_s)
6
+ find(".select2-results li", text: label.to_s).click
7
+ end
8
+ end
9
+
10
+ World(CapybaraSelect2)
@@ -0,0 +1,17 @@
1
+ module CapybaraSignIn
2
+ include ::Warden::Test::Helpers if defined?(Warden)
3
+
4
+ def sign_out
5
+ logout
6
+ end
7
+
8
+ def sign_in(user)
9
+ sign_out
10
+ visit(new_user_session_path)
11
+ fill_in "user_email", with: user.email
12
+ fill_in "user_password", with: user.password
13
+ find("[type=submit]").click
14
+ end
15
+ end
16
+
17
+ World(CapybaraSignIn)
@@ -0,0 +1 @@
1
+ require "simplecov"
@@ -0,0 +1,34 @@
1
+ module CapybaraWaitTurbolinksRequests
2
+ def wait_turbolinks_requests(timeout = Capybara.default_max_wait_time)
3
+ Timeout.timeout(timeout) do
4
+ sleep 0.1 until all_turbolinks_requests_finished?
5
+ end
6
+ end
7
+
8
+ def all_turbolinks_requests_finished?
9
+ have_no_selector("html.turbolinks-load")
10
+ end
11
+
12
+ def turbolinks_defined?
13
+ page.evaluate_script("typeof Turbolinks") != "undefined"
14
+ end
15
+ end
16
+
17
+ World(CapybaraWaitTurbolinksRequests)
18
+
19
+ # Auto wait turbolinks requests between steps
20
+ AfterStep do |_scenario|
21
+ if turbolinks_defined?
22
+ evaluate_script %(
23
+ $(document).on("turbolinks:before-visit", function(){
24
+ $("html").addClass("turbolinks-load")
25
+ })
26
+
27
+ $(document).on("turbolinks:load", function(){
28
+ $("html").removeClass("turbolinks-load")
29
+ })
30
+ )
31
+
32
+ wait_turbolinks_requests
33
+ end
34
+ end
@@ -0,0 +1 @@
1
+ Zonebie.set_random_timezone
@@ -0,0 +1,30 @@
1
+ class << Agilibox::CucumberConfig = Class.new
2
+ undef new
3
+
4
+ attr_writer :phantomjs_version
5
+
6
+ def phantomjs_version
7
+ @phantomjs_version ||= "2.1.1"
8
+ end
9
+
10
+ attr_writer :phantomjs_window_size
11
+
12
+ def phantomjs_window_size
13
+ @phantomjs_window_size ||= [1680, 1050]
14
+ end
15
+
16
+ attr_writer :databasecleaner_tables
17
+
18
+ def databasecleaner_tables
19
+ @databasecleaner_tables ||= %w(
20
+ ar_internal_metadata
21
+ schema_migrations
22
+ spatial_ref_sys
23
+ )
24
+ end
25
+
26
+ def require_all_helpers!
27
+ files = Dir.glob Agilibox::Engine.root.join("features/support/*.rb")
28
+ files.each { |file| require file }
29
+ end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module Agilibox
2
- VERSION = '1.0.8'
2
+ VERSION = "1.0.9"
3
3
  end
@@ -0,0 +1,76 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
6
+
7
+
8
+ unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
9
+
10
+ vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
11
+ $LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
12
+
13
+ begin
14
+ require 'cucumber/rake/task'
15
+
16
+ namespace :cucumber do
17
+ Cucumber::Rake::Task.new({:ok => 'test:prepare'}, 'Run features that should pass') do |t|
18
+ t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
19
+ t.fork = true # You may get faster startup if you set this to false
20
+ t.profile = 'default'
21
+ end
22
+
23
+ Cucumber::Rake::Task.new({:wip => 'test:prepare'}, 'Run features that are being worked on') do |t|
24
+ t.binary = vendored_cucumber_bin
25
+ t.fork = true # You may get faster startup if you set this to false
26
+ t.profile = 'wip'
27
+ end
28
+
29
+ Cucumber::Rake::Task.new({:rerun => 'test:prepare'}, 'Record failing features and run only them if any exist') do |t|
30
+ t.binary = vendored_cucumber_bin
31
+ t.fork = true # You may get faster startup if you set this to false
32
+ t.profile = 'rerun'
33
+ end
34
+
35
+ desc 'Run all features'
36
+ task :all => [:ok, :wip]
37
+
38
+ task :statsetup do
39
+ require 'rails/code_statistics'
40
+ ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
41
+ ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
42
+ end
43
+
44
+ task :annotations_setup do
45
+ Rails.application.configure do
46
+ if config.respond_to?(:annotations)
47
+ config.annotations.directories << 'features'
48
+ config.annotations.register_extensions('feature') { |tag| /#\s*(#{tag}):?\s*(.*)$/ }
49
+ end
50
+ end
51
+ end
52
+ end
53
+ desc 'Alias for cucumber:ok'
54
+ task :cucumber => 'cucumber:ok'
55
+
56
+ task :default => :cucumber
57
+
58
+ task :features => :cucumber do
59
+ STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
60
+ end
61
+
62
+ # In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon.
63
+ task 'test:prepare' do
64
+ end
65
+
66
+ task :stats => 'cucumber:statsetup'
67
+
68
+ task :notes => 'cucumber:annotations_setup'
69
+ rescue LoadError
70
+ desc 'cucumber rake task not available (cucumber not installed)'
71
+ task :cucumber do
72
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
73
+ end
74
+ end
75
+
76
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agilibox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - agilidée
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-12 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails-i18n
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: awesome_print
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  description: Agilibox
28
56
  email:
29
57
  - contact@agilidee.com
@@ -85,6 +113,7 @@ files:
85
113
  - app/sorters/agilibox/sorter.rb
86
114
  - app/views/agilibox/forms/_checkboxes_dropdown.html.slim
87
115
  - app/views/agilibox/search/_form.html.slim
116
+ - config/cucumber.yml
88
117
  - config/locales/actions.en.yml
89
118
  - config/locales/actions.fr.yml
90
119
  - config/locales/attributes.en.yml
@@ -94,13 +123,29 @@ files:
94
123
  - config/locales/dates.fr.yml
95
124
  - config/routes.rb
96
125
  - db/migrate/20170502143330_enable_unaccent.rb
126
+ - features/support/ajax.rb
127
+ - features/support/database_cleaner.rb
128
+ - features/support/env.rb
129
+ - features/support/factory_bot.rb
130
+ - features/support/fix_referrer.rb
131
+ - features/support/poltergeist.rb
132
+ - features/support/rails.rb
133
+ - features/support/rspec.rb
134
+ - features/support/screenshots.rb
135
+ - features/support/select2.rb
136
+ - features/support/sign_in.rb
137
+ - features/support/simplecov.rb
138
+ - features/support/turbolinks.rb
139
+ - features/support/zonebie.rb
97
140
  - lib/agilibox.rb
98
141
  - lib/agilibox/active_record_comma_type_cast.rb
99
142
  - lib/agilibox/core_and_rails_ext.rb
143
+ - lib/agilibox/cucumber_config.rb
100
144
  - lib/agilibox/engine.rb
101
145
  - lib/agilibox/form_back_url.rb
102
146
  - lib/agilibox/version.rb
103
147
  - lib/tasks/agilibox_tasks.rake
148
+ - lib/tasks/cucumber.rake
104
149
  homepage: https://github.com/agilidee/agilibox
105
150
  licenses:
106
151
  - MIT