axlsx_styler 1.0.0 → 1.2.0

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
  SHA256:
3
- metadata.gz: 7afaf1eeca35216610277bc48f73ddbff03344a91a3909d80b7ba43b48c7fe5d
4
- data.tar.gz: 5cdb2b7dd5bd2a85929271852cdcdc7af2743a7acb6c26bddc0ac2bccab067f4
3
+ metadata.gz: 8e2267d5ca327982984c81d1878626c04c7e131faaa00a1658538185bef9b0ed
4
+ data.tar.gz: 3f4fb23d36366e5b87876800306223979f414ccccde4dd6718967edc8d232cdd
5
5
  SHA512:
6
- metadata.gz: 6a4e8bd27a92224b7fbe74e5f0cafd11756c8b841029b6485837728cdcb79a1f1dd5dc3f55d669e8ae9d4ea55fc82f5cf75a40742f583e7ca76823c10b5abde7
7
- data.tar.gz: 8a9df17a77ae556b9bc799f4c9834d0a436bb54667bece8a799caaf6c13cb66b5c7e69fe0430e3c4a6913ad395e53d2e033f6d4d89ce5c810afe0fbe90220806
6
+ metadata.gz: 5290e9be78ca4df5b4c5fca45e60bf5bf648fdfd9bd7891a5fb2b17bdf1a310f23278528218a06070e9d2452af5ad4e7b8827c13d6a9505a185e15c68d0fdf69
7
+ data.tar.gz: 8ed27aff1ffefd5e9b5f2f7b15559b10b2ac1cc7682b51551024c6ec02f0e9ed239d6382e573d9b694ff38018b42aabdf42258e98737828092c486653cfa6058
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ - **Unreleased**
4
+ - Nothing yet
5
+
6
+ - **1.2.0 - October 21, 2022**
7
+ - This gem has now been merged into caxlsx v3.3.0 as such we are now deprecating this gem and dropping support for caxlsx v3.3.0+
8
+ - [#35](https://github.com/axlsx-styler-gem/axlsx_styler/pull/35) - Do not overwrite spreadsheet default font attributes if they have been customized
9
+
10
+ - **1.1.0 - August 26, 2020**
11
+ - [Issue #29](https://github.com/axlsx-styler-gem/axlsx_styler/issues/29) - Fix error `Invalid cellXfs id` when applying `dxf` styles
12
+ - [PR #28](https://github.com/axlsx-styler-gem/axlsx_styler/pull/28) - Allow passing arrays of cell ranges to the `add_style` and `add_border` methods
13
+
3
14
  - **1.0.0 - January 5, 2020**
4
15
  - Switch to the `caxlsx` gem (Community Axlsx) from the legacy unmaintained `axlsx` gem. Axlsx has had a long history of being poorly maintained so this community gem improves the situation.
5
16
  - Require Ruby 2.3+
@@ -7,14 +18,19 @@
7
18
  - Removed unnecessary module `AxlsxStyler::Axlsx`
8
19
  - Major test suite improvements
9
20
  - Add Rails dummy app to test suite and test with `axlsx_rails`
21
+
10
22
  - **0.2.0**
11
23
  - Add support for `axlsx` v3 (at this time for v3.0.0.pre).
12
24
  - Update test suite to run against both v2 and v3 of `axlsx`
25
+
13
26
  - **0.1.7**
14
27
  - Allow mixing vanilla `axlsx` styles and those from `add_style` and `add_border`. See [this example](./examples/mixing_styles.rb)
28
+
15
29
  - **0.1.5**
16
30
  - Hide `Workbook#apply_styles` method to make it easier to use.
31
+
17
32
  - **0.1.3**
18
33
  - Make border styles customizable.
34
+
19
35
  - **0.1.2**
20
36
  - Allow applying multiple style hashes.
data/README.md CHANGED
@@ -1,14 +1,17 @@
1
1
  # axlsx_styler
2
2
 
3
3
  <a href="https://badge.fury.io/rb/axlsx_styler" target="_blank"><img height="21" style='border:0px;height:21px;' border='0' src="https://badge.fury.io/rb/axlsx_styler.svg" alt="Gem Version"></a>
4
- <a href='https://travis-ci.org/axlsx-styler-gem/axlsx_styler' target='_blank'><img height='21' style='border:0px;height:21px;' src='https://api.travis-ci.org/axlsx-styler-gem/axlsx_styler.svg?branch=master' border='0' alt='Build Status' /></a>
4
+ <a href='https://github.com/axlsx-styler-gem/axlsx_styler/actions' target='_blank'><img src="https://github.com/axlsx-styler-gem/axlsx_styler/workflows/Tests/badge.svg" style="max-width:100%;" height='21' style='border:0px;height:21px;' border='0' alt="CI Status"></a>
5
5
  <a href='https://rubygems.org/gems/axlsx_styler' target='_blank'><img height='21' style='border:0px;height:21px;' src='https://ruby-gem-downloads-badge.herokuapp.com/axlsx_styler?label=rubygems&type=total&total_label=downloads&color=brightgreen' border='0' alt='RubyGems Downloads' /></a>
6
6
 
7
+ > **Note**
8
+ > **This gem has been [merged upstream into caxlsx v3.3.0](https://github.com/caxlsx/caxlsx/blob/master/CHANGELOG.md#v3.3.0). Please remove this gem from your Gemfile when using caxlsx@v3.3.0 and above.**
9
+
7
10
  `axlsx_styler` is a gem that allows you to build clean and maintainable styles for your `axlsx` spreadsheets. Build your spreadsheeet with data and then apply styles later.
8
11
 
9
- While [`axlsx`](https://github.com/randym/axlsx) is an excellent tool to build Excel spreadsheets in Ruby, the sheets styles are only applied immediately as the row is created. This makes it very difficult to style easily and effectively.
12
+ While [`axlsx`](https://github.com/caxlsx/caxlsx) is an excellent tool to build Excel spreadsheets in Ruby, the sheets styles are only applied immediately as the row is created. This makes it very difficult to style easily and effectively.
10
13
 
11
- To solve this issue, `axlsx_styler` was born to allow the separatation of styles from content within your `axlsx` code. It gives you the ability to fill out a spreadsheet with data and apply styles later.
14
+ To solve this issue, `axlsx_styler` was born to allow the separation of styles from content within your `axlsx` code. It gives you the ability to fill out a spreadsheet with data and apply styles later.
12
15
 
13
16
  Works well in any Rails app or outside of any specific Ruby framework.
14
17
 
@@ -36,6 +39,12 @@ centered = { alignment: { horizontal: :center } }
36
39
  sheet.add_style 'A2:D2', bold, centered
37
40
  ```
38
41
 
42
+ Applying a style to multiple ranges at once.
43
+
44
+ ```ruby
45
+ sheet.add_style ['A2:G2', "A8:G8", "A12:G12"], b: true, sz: 14
46
+ ```
47
+
39
48
  ## Borders
40
49
 
41
50
  The border style is to draw a thin black border on all four edges of the selected cell range.
@@ -51,6 +60,12 @@ sheet.add_border 'B2:D5', [:bottom, :right]
51
60
  sheet.add_border 'B2:D5', { edges: [:bottom, :right], style: :thick, color: 'FF0000' }
52
61
  ```
53
62
 
63
+ Applying border to multiple ranges at once.
64
+
65
+ ```ruby
66
+ sheet.add_border ['A2:G2', "A8:G8", "A12:G12"]
67
+ ```
68
+
54
69
 
55
70
  ## Example
56
71
 
@@ -1,33 +1,36 @@
1
1
  module AxlsxStyler
2
2
  module Styles
3
3
 
4
- # An index for cell styles
5
- # {
6
- # 1 => < style_hash >,
7
- # 2 => < style_hash >,
8
- # ...
9
- # K => < style_hash >
10
- # }
11
- # where keys are Cell#raw_style and values are styles codes as per Axlsx::Style
12
- attr_accessor :style_index
4
+ # An index for cell styles where keys are styles codes as per Axlsx::Style and values are Cell#raw_style
5
+ # The reason for the backward key/value ordering is that style lookup must be most efficient, while `add_style` can be less efficient
6
+ def style_index
7
+ @style_index ||= {}
8
+ end
13
9
 
14
10
  # Ensure plain axlsx styles are added to the axlsx_styler style_index cache
15
- def add_style(*args)
16
- style = args.first
11
+ def add_style(options={})
12
+ if options[:type] == :dxf
13
+ style_id = super
14
+ else
15
+ ### https://github.com/caxlsx/caxlsx/blob/9b6a78f43b9415bd155bddf6a6d872f5d5555595/lib/axlsx/stylesheet/styles.rb#L459
16
+ font_defaults = {name: @fonts.first.name, sz: @fonts.first.sz, family: @fonts.first.family}
17
17
 
18
- self.style_index ||= {}
18
+ raw_style = {type: :xf}.merge(font_defaults).merge(options)
19
19
 
20
- raw_style = {type: :xf, name: 'Arial', sz: 11, family: 1}.merge(style)
21
- if raw_style[:format_code]
22
- raw_style.delete(:num_fmt)
23
- end
20
+ if raw_style[:format_code]
21
+ raw_style.delete(:num_fmt)
22
+ end
23
+
24
+ style_id = style_index.key(raw_style)
24
25
 
25
- index = style_index.key(raw_style)
26
- if !index
27
- index = super
28
- self.style_index[index] = raw_style
26
+ if !style_id
27
+ style_id = super
28
+
29
+ style_index[style_id] = raw_style
30
+ end
29
31
  end
30
- return index
32
+
33
+ return style_id
31
34
  end
32
35
 
33
36
  end
@@ -19,8 +19,9 @@ module AxlsxStyler
19
19
  return unless styled_cells
20
20
 
21
21
  styled_cells.each do |cell|
22
- if styles.style_index && styles.style_index[cell.style]
23
- current_style = styles.style_index[cell.style]
22
+ current_style = styles.style_index[cell.style]
23
+
24
+ if current_style
24
25
  new_style = current_style.deep_merge(cell.raw_style)
25
26
  else
26
27
  new_style = cell.raw_style
@@ -28,6 +29,7 @@ module AxlsxStyler
28
29
 
29
30
  cell.style = styles.add_style(new_style)
30
31
  end
32
+
31
33
  self.styles_applied = true
32
34
  end
33
35
 
@@ -3,18 +3,28 @@ require_relative './border_creator'
3
3
  module AxlsxStyler
4
4
  module Worksheet
5
5
  # Example to add a single style:
6
- # add_style 'A1:B5', b: true, sz: 14
6
+ # add_style 'A1:B5', b: false
7
+ # add_style ['B1', 'B3'], b: false
8
+ # add_style ['D3:D4', 'F2:F6'], b: false
7
9
  #
8
10
  # Example to add multiple styles:
9
11
  # bold = { b: true }
10
12
  # large_text = { sz: 30 }
11
13
  # add_style 'B2:F8', bold, large_text
12
- def add_style(cell_ref, *styles)
13
- item = self[cell_ref]
14
- cells = item.is_a?(Array) ? item : [item]
15
- cells.each do |cell|
16
- styles.each do |style|
17
- cell.add_style(style)
14
+ def add_style(cell_refs, *styles)
15
+ if !cell_refs.is_a?(Array)
16
+ cell_refs = [cell_refs]
17
+ end
18
+
19
+ cell_refs.each do |cell_ref|
20
+ item = self[cell_ref]
21
+
22
+ cells = item.is_a?(Array) ? item : [item]
23
+
24
+ cells.each do |cell|
25
+ styles.each do |style|
26
+ cell.add_style(style)
27
+ end
18
28
  end
19
29
  end
20
30
  end
@@ -25,9 +35,16 @@ module AxlsxStyler
25
35
  # add_border 'C2:G10', [:top]
26
36
  # add_border 'C2:G10'
27
37
  # add_border 'B2:D5', { style: :thick, color: '00330f', edges: [:left, :right] }
28
- def add_border(cell_ref, args = :all)
29
- cells = self[cell_ref]
30
- BorderCreator.new(self, cells, args).draw
38
+ # add_border ['D3:D4', 'F2:F6'], [:left]
39
+ def add_border(cell_refs, args = :all)
40
+ if !cell_refs.is_a?(Array)
41
+ cell_refs = [cell_refs]
42
+ end
43
+
44
+ cell_refs.each do |cell_ref|
45
+ cells = self[cell_ref]
46
+ BorderCreator.new(self, cells, args).draw
47
+ end
31
48
  end
32
49
  end
33
50
  end
@@ -1,3 +1,3 @@
1
1
  module AxlsxStyler
2
- VERSION = '1.0.0'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
@@ -8,6 +8,10 @@ require 'axlsx_styler'
8
8
 
9
9
  module Dummy
10
10
  class Application < Rails::Application
11
+ if Rails::VERSION::STRING.to_f >= 5.1
12
+ config.load_defaults Rails::VERSION::STRING.to_f
13
+ end
14
+
11
15
  # Settings in config/environments/* take precedence over those specified here.
12
16
  # Application configuration should go into files in config/initializers
13
17
  # -- all .rb files in that directory are automatically loaded.
@@ -36,14 +40,6 @@ module Dummy
36
40
  # Configure sensitive parameters which will be filtered from the log file.
37
41
  config.filter_parameters += [:password]
38
42
 
39
- # Enable the asset pipeline
40
- config.assets.enabled = true
41
-
42
- config.assets.quiet = true
43
-
44
- # Version of your assets, change this if you want to expire all your assets
45
- config.assets.version = '1.0'
46
-
47
43
  config.generators.test_framework = false
48
44
  config.generators.helper = false
49
45
  config.generators.stylesheets = false
@@ -52,12 +48,5 @@ module Dummy
52
48
  config.after_initialize do
53
49
  ActiveRecord::Migration.migrate(Rails.root.join("db/migrate/*").to_s)
54
50
  end
55
-
56
- if ActiveRecord.respond_to?(:gem_version)
57
- gem_version = ActiveRecord.gem_version
58
- if gem_version >= Gem::Version.new("5.2")
59
- config.active_record.sqlite3.represent_boolean_as_integer = true
60
- end
61
- end
62
51
  end
63
52
  end
@@ -6,7 +6,7 @@ end
6
6
 
7
7
  # Save to a file by getting contents from stream
8
8
  def to_stream(filename)
9
- File.open(File.expand_path("../../tmp/#{filename}.xlsx", __FILE__), 'w') do |f|
9
+ File.open(File.expand_path("../../tmp/#{filename}.xlsx", __FILE__), 'wb') do |f|
10
10
  f.write @axlsx.to_stream.read
11
11
  end
12
12
  end
data/test/test_helper.rb CHANGED
@@ -1,9 +1,21 @@
1
1
  ENV["RAILS_ENV"] = "test"
2
2
 
3
+ begin
4
+ require 'warning'
5
+
6
+ Warning.ignore(
7
+ %r{mail/parsers/address_lists_parser}, ### Hide mail gem warnings
8
+ )
9
+ rescue LoadError
10
+ # Do nothing
11
+ end
12
+
3
13
  require File.expand_path("../dummy_app/config/environment.rb", __FILE__)
4
14
 
5
15
  migration_path = Rails.root.join('db/migrate')
6
- if ActiveRecord.gem_version >= ::Gem::Version.new("5.2.0")
16
+ if ActiveRecord.gem_version >= ::Gem::Version.new("6.0.0")
17
+ ActiveRecord::MigrationContext.new(migration_path, ActiveRecord::SchemaMigration).migrate
18
+ elsif ActiveRecord.gem_version >= ::Gem::Version.new("5.2.0")
7
19
  ActiveRecord::MigrationContext.new(migration_path).migrate
8
20
  else
9
21
  ActiveRecord::Migrator.migrate(migration_path)
@@ -21,7 +33,6 @@ end
21
33
  require 'minitest/reporters'
22
34
  Minitest::Reporters.use!
23
35
 
24
- require 'custom_assertions'
25
36
  require 'helper_methods'
26
37
 
27
38
  ### Cleanup old test spreadsheets
@@ -0,0 +1,44 @@
1
+ require 'test_helper'
2
+
3
+ class RegressionsTest < MiniTest::Test
4
+
5
+ def setup
6
+ @axlsx = Axlsx::Package.new
7
+ @workbook = @axlsx.workbook
8
+ end
9
+
10
+ def test_dxf_cell
11
+ @workbook.add_worksheet do |sheet|
12
+ sheet.add_row (1..2).to_a
13
+ sheet.add_style "A1:A1", { bg_color: "AA0000" }
14
+
15
+ sheet.add_row (1..2).to_a
16
+ sheet.add_style "B1:B1", { bg_color: "CC0000" }
17
+
18
+ sheet.add_row (1..2).to_a
19
+ sheet.add_style "A3:B3", { bg_color: "00FF00" }
20
+
21
+ highlight = @workbook.styles.add_style(bg_color: "0000FF", type: :dxf)
22
+
23
+ sheet.add_conditional_formatting(
24
+ "A2:B2",
25
+ {
26
+ type: :cellIs,
27
+ operator: :greaterThan,
28
+ formula: "1",
29
+ dxfId: highlight,
30
+ priority: 1
31
+ }
32
+ )
33
+ end
34
+
35
+ serialize("test_dxf_cell")
36
+
37
+ #puts @workbook.styles.dxfs.map{|x| x.to_xml_string}
38
+ assert_equal @workbook.styles.dxfs.count, 1
39
+
40
+ #puts @workbook.styles.cellXfs.map{|x| x.to_xml_string}
41
+ assert_equal @workbook.styles.cellXfs.count, 6
42
+ end
43
+
44
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: axlsx_styler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Weston Ganger
8
8
  - Anton Sakovich
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-25 00:00:00.000000000 Z
12
+ date: 2022-10-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: caxlsx
@@ -18,6 +18,9 @@ dependencies:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 2.0.2
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: 3.3.0
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -25,6 +28,9 @@ dependencies:
25
28
  - - ">="
26
29
  - !ruby/object:Gem::Version
27
30
  version: 2.0.2
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.3.0
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: activesupport
30
36
  requirement: !ruby/object:Gem::Requirement
@@ -137,6 +143,20 @@ dependencies:
137
143
  - - ">="
138
144
  - !ruby/object:Gem::Version
139
145
  version: '0'
146
+ - !ruby/object:Gem::Dependency
147
+ name: warning
148
+ requirement: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ type: :development
154
+ prerelease: false
155
+ version_requirements: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
140
160
  description: Build clean and maintainable styles for your axlsx spreadsheets. Build
141
161
  your spreadsheeet with data and then apply styles later.
142
162
  email:
@@ -158,8 +178,8 @@ files:
158
178
  - lib/axlsx_styler/axlsx_worksheet.rb
159
179
  - lib/axlsx_styler/border_creator.rb
160
180
  - lib/axlsx_styler/version.rb
161
- - test/custom_assertions.rb
162
181
  - test/dummy_app/Rakefile
182
+ - test/dummy_app/app/assets/config/manifest.js
163
183
  - test/dummy_app/app/assets/javascripts/application.js
164
184
  - test/dummy_app/app/assets/stylesheets/application.css
165
185
  - test/dummy_app/app/controllers/application_controller.rb
@@ -172,8 +192,6 @@ files:
172
192
  - test/dummy_app/config/boot.rb
173
193
  - test/dummy_app/config/database.yml
174
194
  - test/dummy_app/config/environment.rb
175
- - test/dummy_app/config/environments/development.rb
176
- - test/dummy_app/config/environments/production.rb
177
195
  - test/dummy_app/config/environments/test.rb
178
196
  - test/dummy_app/config/initializers/backtrace_silencers.rb
179
197
  - test/dummy_app/config/initializers/inflections.rb
@@ -185,22 +203,20 @@ files:
185
203
  - test/dummy_app/config/routes.rb
186
204
  - test/dummy_app/config/secrets.yml
187
205
  - test/dummy_app/db/schema.rb
188
- - test/dummy_app/db/test.sqlite3
189
- - test/dummy_app/log/test.log
190
206
  - test/helper_methods.rb
191
207
  - test/integration/application_test.rb
192
208
  - test/test_helper.rb
193
209
  - test/unit/borders_test.rb
194
210
  - test/unit/examples_test.rb
195
- - test/unit/general_test.rb
196
211
  - test/unit/merge_styles_test.rb
212
+ - test/unit/regresssions_test.rb
197
213
  - test/unit/serialize_test.rb
198
214
  - test/unit/to_stream_test.rb
199
215
  homepage: https://github.com/axlsx-styler-gem/axlsx_styler
200
216
  licenses:
201
217
  - MIT
202
218
  metadata: {}
203
- post_install_message:
219
+ post_install_message:
204
220
  rdoc_options: []
205
221
  require_paths:
206
222
  - lib
@@ -215,13 +231,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
231
  - !ruby/object:Gem::Version
216
232
  version: '0'
217
233
  requirements: []
218
- rubygems_version: 3.0.3
219
- signing_key:
234
+ rubygems_version: 3.1.2
235
+ signing_key:
220
236
  specification_version: 4
221
237
  summary: Build clean and maintainable styles for your axlsx spreadsheets. Build your
222
238
  spreadsheeet with data and then apply styles later.
223
239
  test_files:
224
- - test/custom_assertions.rb
240
+ - test/dummy_app/app/assets/config/manifest.js
225
241
  - test/dummy_app/app/assets/javascripts/application.js
226
242
  - test/dummy_app/app/assets/stylesheets/application.css
227
243
  - test/dummy_app/app/controllers/application_controller.rb
@@ -233,8 +249,6 @@ test_files:
233
249
  - test/dummy_app/config/boot.rb
234
250
  - test/dummy_app/config/database.yml
235
251
  - test/dummy_app/config/environment.rb
236
- - test/dummy_app/config/environments/development.rb
237
- - test/dummy_app/config/environments/production.rb
238
252
  - test/dummy_app/config/environments/test.rb
239
253
  - test/dummy_app/config/initializers/backtrace_silencers.rb
240
254
  - test/dummy_app/config/initializers/inflections.rb
@@ -247,15 +261,13 @@ test_files:
247
261
  - test/dummy_app/config/secrets.yml
248
262
  - test/dummy_app/config.ru
249
263
  - test/dummy_app/db/schema.rb
250
- - test/dummy_app/db/test.sqlite3
251
- - test/dummy_app/log/test.log
252
264
  - test/dummy_app/Rakefile
253
265
  - test/helper_methods.rb
254
266
  - test/integration/application_test.rb
255
267
  - test/test_helper.rb
256
268
  - test/unit/borders_test.rb
257
269
  - test/unit/examples_test.rb
258
- - test/unit/general_test.rb
259
270
  - test/unit/merge_styles_test.rb
271
+ - test/unit/regresssions_test.rb
260
272
  - test/unit/serialize_test.rb
261
273
  - test/unit/to_stream_test.rb
@@ -1,21 +0,0 @@
1
- def assert_changed(expression, &block)
2
- if expression.respond_to?(:call)
3
- e = expression
4
- else
5
- e = lambda{ eval(expression, block.binding) }
6
- end
7
- old = e.call
8
- block.call
9
- assert_not_equal old, e.call
10
- end
11
-
12
- def assert_not_changed(expression, &block)
13
- if expression.respond_to?(:call)
14
- e = expression
15
- else
16
- e = lambda{ eval(expression, block.binding) }
17
- end
18
- old = e.call
19
- block.call
20
- assert_equal old, e.call
21
- end
@@ -1,30 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
11
-
12
- # Show full error reports and disable caching
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send
17
- config.action_mailer.raise_delivery_errors = false
18
-
19
- # Print deprecation notices to the Rails logger
20
- config.active_support.deprecation = :log
21
-
22
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
24
-
25
- # Do not compress assets
26
- config.assets.compress = false
27
-
28
- # Expands the lines which load the assets
29
- config.assets.debug = true
30
- end
@@ -1,60 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # Code is not reloaded between requests
5
- config.cache_classes = true
6
-
7
- # Full error reports are disabled and caching is turned on
8
- config.consider_all_requests_local = false
9
- config.action_controller.perform_caching = true
10
-
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_files = false
13
-
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
16
-
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
18
- config.assets.compile = false
19
-
20
- # Generate digests for assets URLs
21
- config.assets.digest = true
22
-
23
- # Defaults to Rails.root.join("public/assets")
24
- # config.assets.manifest = YOUR_PATH
25
-
26
- # Specifies the header that your server uses for sending files
27
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
-
30
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
- # config.force_ssl = true
32
-
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
35
-
36
- # Use a different logger for distributed setups
37
- # config.logger = SyslogLogger.new
38
-
39
- # Use a different cache store in production
40
- # config.cache_store = :mem_cache_store
41
-
42
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
43
- # config.action_controller.asset_host = "http://assets.example.com"
44
-
45
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
46
- # config.assets.precompile += %w( search.js )
47
-
48
- # Disable delivery errors, bad email addresses will be ignored
49
- # config.action_mailer.raise_delivery_errors = false
50
-
51
- # Enable threaded mode
52
- # config.threadsafe!
53
-
54
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
55
- # the I18n.default_locale when a translation can not be found)
56
- config.i18n.fallbacks = true
57
-
58
- # Send deprecation notices to registered listeners
59
- config.active_support.deprecation = :notify
60
- end
Binary file