active_decorator-rspec 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c663ea68b5384b69af39e822ad6a3dd9cf1f383d
4
+ data.tar.gz: 8f665f5c1ff6a9f429c97ee60415b1b3e6204484
5
+ SHA512:
6
+ metadata.gz: 5a09fc1769d68121f772d355eee5968cf24ab0ccfeb3b68159e6bd846f0835d39cc8b8202b707d8b77ddb2b3ce4c1fe4deb5cb3c9b1f4bf66f402cbd6259c4ca
7
+ data.tar.gz: 11f00aa6439d9bf8705ed566384907d42ca1f464e7a2c12cc6806a5d29d8d1690eeb82e749f95c08bd7b08486886a60a5950b840b0384cde1c84e6f5a892d16b
data/.gitignore ADDED
@@ -0,0 +1,27 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .rspec
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/dummy/app_*/db/*.sqlite3
16
+ spec/dummy/app_*/log/*.log
17
+ spec/dummy/app_*/tmp/
18
+ spec/reports
19
+ test/tmp
20
+ test/version_tmp
21
+ tmp
22
+ *.bundle
23
+ *.so
24
+ *.o
25
+ *.a
26
+ mkmf.log
27
+ log/*.log
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 2.1.1
6
+
7
+ before_install:
8
+ - gem update bundler
9
+
10
+ script:
11
+ - bundle exec rspec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in active_decorator-rspec.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 mizokami
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # ActiveDecorator::RSpec
2
+
3
+ [![Build Status](https://img.shields.io/travis/mizoR/active_decorator-rspec/master.svg?style=flat)](https://travis-ci.org/mizoR/active_decorator-rspec)
4
+ [![Code Climate](https://img.shields.io/codeclimate/github/mizoR/active_decorator-rspec/badges/gpa.svg?style=flat)](https://codeclimate.com/github/mizoR/active_decorator-rspec)
5
+ [![Dependency Status](https://img.shields.io/gemnasium/mizoR/active_decorator-rspec.svg?style=flat)](https://gemnasium.com/mizoR/active_decorator-rspec)
6
+
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'active_decorator-rspec'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install active_decorator-rspec
21
+
22
+ ## Usage
23
+
24
+ First you need to require active_decorator/rspec in your spec_helper.rb:
25
+
26
+ ```
27
+ require "active_decorator/rspec"
28
+ ```
29
+
30
+ And You will need to include ActiveDecorator::RSpec in your example groups:
31
+
32
+ ```
33
+ config.include ActiveDecorator::RSpec, type: :decorator
34
+ ```
35
+
36
+ ## Contributing
37
+
38
+ 1. Fork it ( https://github.com/[my-github-username]/active_decorator-rspec/fork )
39
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
40
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
41
+ 4. Push to the branch (`git push origin my-new-feature`)
42
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'active_decorator/rspec/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "active_decorator-rspec"
8
+ spec.version = ActiveDecorator::RSpec::VERSION
9
+ spec.authors = ["mizokami"]
10
+ spec.email = ["suzunatsu@yahoo.com"]
11
+ spec.summary = %q{ActiveDecorator::RSpec}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "actionpack"
21
+ spec.add_dependency "active_decorator"
22
+ spec.add_dependency "activesupport"
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rails"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "rspec-its"
28
+ spec.add_development_dependency "sqlite3"
29
+ end
@@ -0,0 +1,5 @@
1
+ module ActiveDecorator
2
+ module RSpec
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,28 @@
1
+ require "active_decorator"
2
+ require "action_controller"
3
+ require "action_controller/test_case"
4
+ require "active_decorator/rspec/version"
5
+
6
+ module ActiveDecorator
7
+ module RSpec
8
+ module HelperMethods
9
+ def decorate(obj)
10
+ ActiveDecorator::Decorator.instance.decorate(obj)
11
+ obj
12
+ end
13
+ end
14
+
15
+ def self.included(config)
16
+ config.before :each do
17
+ ActiveDecorator::ViewContext.current = begin
18
+ controller = Class.new(ActionController::Base).new
19
+ controller.request = ActionController::TestRequest.new
20
+ view_context = controller.view_context
21
+ view_context
22
+ end
23
+ end
24
+
25
+ ::RSpec::Core::ExampleGroup.send(:include, HelperMethods)
26
+ end
27
+ end
28
+ end
data/spec/dummy_app.rb ADDED
@@ -0,0 +1,52 @@
1
+ require "active_record"
2
+ require 'action_controller/railtie'
3
+ require 'action_view/railtie'
4
+
5
+ ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
6
+
7
+ module DummyApp
8
+ class Application < Rails::Application
9
+ config.secret_token = 'b704c82f069d36a40b3ea167a45a16a0'
10
+ config.session_store :cookie_store, :key => '_dummy_app_session'
11
+ config.active_support.deprecation = :log
12
+ config.eager_load = false
13
+ end
14
+ end
15
+ DummyApp::Application.initialize!
16
+
17
+ DummyApp::Application.routes.draw do
18
+ resources :authors, only: [:index, :show, :update]
19
+ end
20
+
21
+ module ApplicationHelper
22
+ end
23
+
24
+ module AuthorDecorator
25
+ def reverse_name
26
+ name.to_s.reverse
27
+ end
28
+
29
+ def link
30
+ link_to name, self
31
+ end
32
+
33
+ def form
34
+ form_for(self) {|f| f.text_field :name }
35
+ end
36
+
37
+ def url
38
+ author_url(self)
39
+ end
40
+ end
41
+
42
+ class ApplicationController < ActionController::Base
43
+ end
44
+
45
+ class Author < ActiveRecord::Base
46
+ end
47
+
48
+ class CreateAuthors < ActiveRecord::Migration
49
+ def self.up
50
+ create_table(:authors) {|t| t.string :name}
51
+ end
52
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe AuthorDecorator, type: :decorator do
4
+ let(:author) { Author.create(name: "boo") }
5
+
6
+ subject { decorate author }
7
+
8
+ describe do
9
+ its(:reverse_name) { should eq("oob") }
10
+
11
+ its(:form) {
12
+ should match %r|^<form accept-charset="UTF-8" action="/authors/#{author.id}" class="edit_author" id="edit_author_#{author.id}" method="post">|
13
+ should match %r|<input id="author_name" name="author\[name\]" type="text" value="boo" />|
14
+ should match %r|</form>$|
15
+ }
16
+
17
+ its(:link) { should eq %(<a href="/authors/#{author.id}">boo</a>) }
18
+
19
+ its(:url) { should eq "http://test.host/authors/#{author.id}" }
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ require "active_support"
2
+ require "active_decorator"
3
+ require "active_decorator/rspec"
4
+ require "rspec/its"
5
+
6
+ require File.join(File.dirname(__FILE__), "dummy_app.rb")
7
+
8
+ RSpec.configure do |config|
9
+ config.include ActiveDecorator::RSpec, type: :decorator
10
+
11
+ config.before :all do
12
+ CreateAuthors.up if !ActiveRecord::Base.connection.table_exists?('authors')
13
+ end
14
+
15
+ config.after :each do
16
+ Author.delete_all
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,185 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_decorator-rspec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - mizokami
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: actionpack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: active_decorator
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: activesupport
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'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.6'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec-its
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: sqlite3
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description:
140
+ email:
141
+ - suzunatsu@yahoo.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".gitignore"
147
+ - ".travis.yml"
148
+ - Gemfile
149
+ - LICENSE.txt
150
+ - README.md
151
+ - Rakefile
152
+ - active_decorator-rspec.gemspec
153
+ - lib/active_decorator/rspec.rb
154
+ - lib/active_decorator/rspec/version.rb
155
+ - spec/dummy_app.rb
156
+ - spec/features/decorator_spec.rb
157
+ - spec/spec_helper.rb
158
+ homepage: ''
159
+ licenses:
160
+ - MIT
161
+ metadata: {}
162
+ post_install_message:
163
+ rdoc_options: []
164
+ require_paths:
165
+ - lib
166
+ required_ruby_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ requirements: []
177
+ rubyforge_project:
178
+ rubygems_version: 2.2.2
179
+ signing_key:
180
+ specification_version: 4
181
+ summary: ActiveDecorator::RSpec
182
+ test_files:
183
+ - spec/dummy_app.rb
184
+ - spec/features/decorator_spec.rb
185
+ - spec/spec_helper.rb