r_decorator 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/gemfiles/Gemfile-rails.3.0.x +1 -1
- data/gemfiles/Gemfile-rails.3.1.x +1 -1
- data/lib/r_decorator/rspec.rb +19 -0
- data/lib/r_decorator/version.rb +1 -1
- data/spec/{features/decorator_spec.rb → decorators/definition_spec.rb} +0 -0
- data/spec/decorators/view_helpers_spec.rb +7 -0
- data/spec/fake_app/authors/index.html.erb +1 -0
- data/spec/fake_app/fake_app.rb +5 -1
- data/spec/features/controller_ivar_spec.rb +1 -0
- data/spec/spec_helper.rb +2 -1
- metadata +7 -4
@@ -0,0 +1,19 @@
|
|
1
|
+
module RSpec::Rails::RDecoratorExampleGroup
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
include RSpec::Rails::RailsExampleGroup
|
4
|
+
include ActionView::TestCase::Behavior
|
5
|
+
|
6
|
+
included do
|
7
|
+
metadata[:type] = :decorator
|
8
|
+
|
9
|
+
before do
|
10
|
+
RDecorator::ViewContext.current = controller.view_context
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
RSpec::configure do |c|
|
16
|
+
c.include RSpec::Rails::RDecoratorExampleGroup, :type => :decorator, :example_group => {
|
17
|
+
:file_path => c.escaped_path(%w[spec decorators])
|
18
|
+
}
|
19
|
+
end
|
data/lib/r_decorator/version.rb
CHANGED
File without changes
|
data/spec/fake_app/fake_app.rb
CHANGED
@@ -36,6 +36,10 @@ module ApplicationHelper; end
|
|
36
36
|
class ApplicationDecorator < RDecorator::Base
|
37
37
|
end
|
38
38
|
class AuthorDecorator < ApplicationDecorator
|
39
|
+
def name_link
|
40
|
+
link_to origin.name, author_path(origin), title: origin.name
|
41
|
+
end
|
42
|
+
|
39
43
|
def reverse_name
|
40
44
|
name.reverse
|
41
45
|
end
|
@@ -52,7 +56,7 @@ class BookDecorator < ApplicationDecorator
|
|
52
56
|
def upcased_title
|
53
57
|
title.upcase
|
54
58
|
end
|
55
|
-
|
59
|
+
|
56
60
|
def link
|
57
61
|
link_to title, "#{request.protocol}#{request.host_with_port}/assets/sample.png"
|
58
62
|
end
|
@@ -19,6 +19,7 @@ feature 'decorating controller ivar' do
|
|
19
19
|
visit '/authors'
|
20
20
|
page.should have_content 'takahashim'
|
21
21
|
page.should have_content 'takahashim'.reverse
|
22
|
+
page.should have_selector 'a[title="takahashim"]'
|
22
23
|
end
|
23
24
|
|
24
25
|
scenario "decorating models' array in ivar" do
|
data/spec/spec_helper.rb
CHANGED
@@ -7,7 +7,8 @@ require 'r_decorator'
|
|
7
7
|
require 'fake_app/fake_app'
|
8
8
|
require 'rspec/rails'
|
9
9
|
require 'capybara/rspec'
|
10
|
-
|
10
|
+
require 'r_decorator/rspec'
|
11
|
+
|
11
12
|
# Requires supporting files with custom matchers and macros, etc,
|
12
13
|
# in ./support/ and its subdirectories.
|
13
14
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r_decorator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A readable and simple view helper for Rails 3
|
15
15
|
email:
|
@@ -37,9 +37,12 @@ files:
|
|
37
37
|
- lib/r_decorator.rb
|
38
38
|
- lib/r_decorator/base.rb
|
39
39
|
- lib/r_decorator/railtie.rb
|
40
|
+
- lib/r_decorator/rspec.rb
|
40
41
|
- lib/r_decorator/version.rb
|
41
42
|
- lib/r_decorator/view_context.rb
|
42
43
|
- r_decortator.gemspec
|
44
|
+
- spec/decorators/definition_spec.rb
|
45
|
+
- spec/decorators/view_helpers_spec.rb
|
43
46
|
- spec/fake_app/authors/index.html.erb
|
44
47
|
- spec/fake_app/authors/show.html.erb
|
45
48
|
- spec/fake_app/books/_book.html.erb
|
@@ -48,7 +51,6 @@ files:
|
|
48
51
|
- spec/fake_app/fake_app.rb
|
49
52
|
- spec/features/action_view_helpers_spec.rb
|
50
53
|
- spec/features/controller_ivar_spec.rb
|
51
|
-
- spec/features/decorator_spec.rb
|
52
54
|
- spec/features/partial_spec.rb
|
53
55
|
- spec/spec_helper.rb
|
54
56
|
homepage: https://github.com/takuya327/r_decorator
|
@@ -76,6 +78,8 @@ signing_key:
|
|
76
78
|
specification_version: 3
|
77
79
|
summary: A readable and simple view helper for Rails 3
|
78
80
|
test_files:
|
81
|
+
- spec/decorators/definition_spec.rb
|
82
|
+
- spec/decorators/view_helpers_spec.rb
|
79
83
|
- spec/fake_app/authors/index.html.erb
|
80
84
|
- spec/fake_app/authors/show.html.erb
|
81
85
|
- spec/fake_app/books/_book.html.erb
|
@@ -84,6 +88,5 @@ test_files:
|
|
84
88
|
- spec/fake_app/fake_app.rb
|
85
89
|
- spec/features/action_view_helpers_spec.rb
|
86
90
|
- spec/features/controller_ivar_spec.rb
|
87
|
-
- spec/features/decorator_spec.rb
|
88
91
|
- spec/features/partial_spec.rb
|
89
92
|
- spec/spec_helper.rb
|