Commit Graph

17 Commits

Author SHA1 Message Date
Cliff Braton cb9af6c9dc
Merge remote-tracking branch 'origin/master' into feature/rspec3-updates
# Conflicts:
#	.travis.yml
#	Gemfile
#	Guardfile
#	draper.gemspec
#	lib/generators/rspec/templates/decorator_spec.rb
#	spec/draper/collection_decorator_spec.rb
#	spec/draper/decoratable_spec.rb
#	spec/draper/decorated_association_spec.rb
#	spec/draper/decorates_assigned_spec.rb
#	spec/draper/decorator_spec.rb
#	spec/draper/factory_spec.rb
#	spec/draper/finders_spec.rb
#	spec/draper/view_context/build_strategy_spec.rb
#	spec/draper/view_context_spec.rb
#	spec/dummy/fast_spec/post_decorator_spec.rb
#	spec/dummy/spec/models/post_spec.rb
#	spec/generators/controller/controller_generator_spec.rb
#	spec/generators/decorator/decorator_generator_spec.rb
#	spec/support/shared_examples/view_helpers.rb
2019-03-20 12:59:34 -05:00
Shu Fujita 157eb95507 Clean and remove empty lines (#844)
## Description
Clean and remove empty lines by Rubocop.
2019-02-25 12:22:28 -06:00
Luciano Sousa 447816cf10 update rspec syntax to the new one 2016-06-09 18:49:42 -03:00
Kurtis Rainbolt-Greene d358537d12 rspec-rails ~> 3.3. Fixes #668. Update Spec Synax
As of rspec-rails 3.3 they generate two files:

  - spec/spec_helper.rb
  - spec/rails_helper.rb

This allows the user to either do pure ruby unit tests or include the entire
rails environment. Draper really only works in a rails application if it has the
rails environment. This matches ~> 3.2 and uses the rails_helper instead of
spec_helper for the dummy app specs, but the standard spec_helper for
the draper specs.

Fix Spec spec generator because RSpec no longer prefers
monkey-patching. Refactor PR #675 to be more concise re RSpec Version
check, and to use RSpec::Core::Version rather than
RSpec::Rails::Version, in case the latter does not exist.

Updated all specs to RSpec 3.0 syntax
=====================================

Change specs to use synax `expect(OBJECT).to EXPECTATION` rather that
`OBJECT.should`. Changed all `OBJECT.stub(METHOD)` to `allow(OBJECT).to
receive(:method)`

Change one-liners to use syntax: `it { is_expected.to XXX }` rather than
`it { should }`.

Merge PR #674 from @mcasper and fix all trivial conflicts (i.e
`allow(OBJ).to receive(:message)` vs `allow(OBJ).to receive_messages`)

Gitignore
=========

Ignore .ruby_version and .ruby_gemset

Spec Helper
===========
ActiveRecord::Migration.maintain_test_schema! is undefined in Rails
4.0, so I made that method conditional upon ENV['RAILS_VERSION']
2015-08-27 14:36:13 -06:00
Morgan Lieberthal 66bc7ad6fc Merge branch 'mcasper/update_to_rspec_3_syntax'
Conflicts:
	spec/draper/collection_decorator_spec.rb
	spec/draper/decoratable_spec.rb
	spec/draper/decorated_association_spec.rb
	spec/draper/decorates_assigned_spec.rb
	spec/draper/decorator_spec.rb
	spec/draper/factory_spec.rb
	spec/draper/finders_spec.rb
	spec/draper/helper_proxy_spec.rb
	spec/draper/view_context/build_strategy_spec.rb
	spec/draper/view_context_spec.rb
	spec/support/shared_examples/view_helpers.rb
2015-08-27 02:17:36 -06:00
Morgan Lieberthal f4bb26bd53 Updated all specs to RSpec 3.0 syntax
Change specs to use synax `expect(OBJECT).to EXPECTATION` rather that
`OBJECT.should`. Changed all `OBJECT.stub(METHOD)` to `allow(OBJECT).to
receive(:method)`

Change one-liners to use syntax: `it { is_expected.to XXX }` rather than
`it { should }`.
2015-08-27 01:08:59 -06:00
Matt Casper 036be08ded Update the rest of the specs to rspec3 syntax 2015-05-21 09:53:15 -07:00
Jeff Casimir d0149b1c8f Rewrite some of the .stub calls to use allow 2015-03-26 23:21:37 -06:00
Jordan Killpack 67638332ce Decorate structs as singular objects (and not as collections)
Since structs respond to `.first`, Draper thinks they're collections and
always tries to wrap them in CollectionDecorators, which is surprising!

This is similar to the issue and fix in [#259].
2014-06-03 16:46:22 -04:00
Andrew Haines 4b933ef39d Rename `source` to `object`
Closes #501
2013-04-30 14:10:52 +01:00
Andrew Haines 234fbd98c6 Fix decoration of unsaved collection associations
Calling `#decorate` on an unsaved collection association forced a
db lookup, clearing any items that have been added (e.g. using
`#build`).

Closes #518.
2013-04-20 19:37:14 +01:00
Andrew Haines f64859e302 Use source.decorate when decorator is not specified
Closes #490
2013-03-10 09:33:38 +01:00
Andrew Haines 2444c09bdc Revert "Merge pull request #480 from urbanautomaton/decorator-namespace-option"
This reverts commit f93542ca7c, reversing
changes made to f4dd9e0206.
2013-03-10 09:27:12 +01:00
Simon Coffey b1d66ca15c Add option to specify namespace for decorator lookup
To use different decorators in different contexts (e.g. HTML rendering
vs. API representation), the ability to specify a decorator namespace is
added. For example:

    > Product.new.decorate
    => #<ProductDecorator:0x0000010b6e47e8>
    > Product.new.decorate(:namespace => HTML)
    => #<HTML::ProductDecorator:0x0000010b6e47e9>
2013-02-19 20:00:23 +00:00
Andrew Haines 70169d4ddf Wrap context_args to avoid splatting hashes 2013-02-19 15:07:44 +00:00
Andrew Haines 668661f13a Accept a lambda for context
Closes #467
2013-02-17 16:56:49 +00:00
Andrew Haines a6a60bcf92 Extract Factory from DecoratedAssociation 2013-02-07 01:00:48 +00:00