rspec-action_view 0.1.0

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/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --format nested --color
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Kristian Mandrup
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,38 @@
1
+ # Rspec for Rails 3 ActionView
2
+
3
+ RSpec 2 library to make it simple to spec Rails 3 ActionView extensions
4
+
5
+ ## Install
6
+
7
+ <code>gem install rspec-active_view</code>
8
+
9
+ ## Usage
10
+
11
+ <pre>
12
+ describe "My ViewHelpers" do
13
+ it "should render content as expected" do
14
+ setup_action_view do
15
+ tests MyViewHelper, MyOtherViewHelper
16
+ end
17
+
18
+ with_action_view do |view|
19
+ view.tab_for('kristian') { 'hello' }.should match /kristian/
20
+ view.hello('david') { 'hello' }.should match /david/
21
+ end
22
+ end
23
+ end
24
+ </pre>
25
+
26
+ ## Note on Patches/Pull Requests
27
+
28
+ * Fork the project.
29
+ * Make your feature addition or bug fix.
30
+ * Add tests for it. This is important so I don't break it in a
31
+ future version unintentionally.
32
+ * Commit, do not mess with rakefile, version, or history.
33
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
34
+ * Send me a pull request. Bonus points for topic branches.
35
+
36
+ ## Copyright
37
+
38
+ Copyright (c) 2010 Kristian Mandrup. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gem|
4
+ gem.name = "rspec-action_view"
5
+ gem.summary = %Q{RSpec for Rails 3 ActionView extensions}
6
+ gem.description = %Q{RSpec 2 library to make it simple to spec Rails 3 ActionView extensions}
7
+ gem.email = "kmandrup@gmail.com"
8
+ gem.homepage = "http://github.com/kristianmandrup/rspec-action_view"
9
+ gem.authors = ["Kristian Mandrup"]
10
+ gem.add_development_dependency "rspec", ">= 1.2.9"
11
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
12
+ end
13
+ Jeweler::GemcutterTasks.new
14
+ rescue LoadError
15
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
16
+ end
17
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,37 @@
1
+ # require 'active_support'
2
+ require 'action_view'
3
+ require 'active_support/railtie'
4
+ require 'action_view/template/handlers/erb'
5
+
6
+ class ActionViewTester
7
+ include ActionView::Helpers::TagHelper
8
+ include ActionView::Helpers::CaptureHelper
9
+
10
+ def initialize &block
11
+ if block
12
+ block.arity < 1 ? self.instance_eval(&block) : block.call(self)
13
+ end
14
+ end
15
+
16
+ def with_output_buffer(buf = nil)
17
+ yield
18
+ end
19
+
20
+ def self.tests *helpers
21
+ helpers.flatten.each do |name|
22
+ include name.to_s.camelize.constantize
23
+ end
24
+ end
25
+ end
26
+
27
+ module RSpec::Core
28
+ class ExampleGroup
29
+ def with_action_view &block
30
+ block.call(ActionViewTester.new)
31
+ end
32
+
33
+ def setup_action_view &block
34
+ ActionViewTester.instance_eval(&block)
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,55 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{rspec-action_view}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Kristian Mandrup"]
12
+ s.date = %q{2010-08-23}
13
+ s.description = %q{RSpec 2 library to make it simple to spec Rails 3 ActionView extensions}
14
+ s.email = %q{kmandrup@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.markdown"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ ".rspec",
23
+ "LICENSE",
24
+ "README.markdown",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/rspec-action_view.rb",
28
+ "rspec-action_view.gemspec",
29
+ "spec/rspec-action_view_spec.rb",
30
+ "spec/spec_helper.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/kristianmandrup/rspec-action_view}
33
+ s.rdoc_options = ["--charset=UTF-8"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.3.7}
36
+ s.summary = %q{RSpec for Rails 3 ActionView extensions}
37
+ s.test_files = [
38
+ "spec/rspec-action_view_spec.rb",
39
+ "spec/spec_helper.rb"
40
+ ]
41
+
42
+ if s.respond_to? :specification_version then
43
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
48
+ else
49
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
50
+ end
51
+ else
52
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
53
+ end
54
+ end
55
+
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ module MyViewHelper
4
+ def tab_for(clazz, &block)
5
+ content = with_output_buffer(&block)
6
+ content_tag :li, content, :class => clazz
7
+ end
8
+ end
9
+
10
+ module MyOtherViewHelper
11
+ def hello(clazz, &block)
12
+ content = with_output_buffer(&block)
13
+ content_tag :div, content, :class => clazz
14
+ end
15
+ end
16
+
17
+
18
+ describe "My ViewHelpers" do
19
+ it "should render content as expected" do
20
+ setup_action_view do
21
+ tests MyViewHelper, MyOtherViewHelper
22
+ end
23
+
24
+ with_action_view do |view|
25
+ view.tab_for('kristian') { 'hello' }.should match /kristian/
26
+ view.hello('david') { 'hello' }.should match /david/
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,15 @@
1
+ require 'rspec'
2
+ require 'rspec/autorun'
3
+ require 'rspec-action_view'
4
+
5
+ # module Minimal
6
+ # class Application < Rails::Application
7
+ # config.active_support.deprecation = :log
8
+ # end
9
+ # end
10
+ #
11
+ # Rails.application = Minimal::Application
12
+
13
+ RSpec.configure do |config|
14
+ config.mock_with :mocha
15
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-action_view
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Kristian Mandrup
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-08-23 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 2
31
+ - 9
32
+ version: 1.2.9
33
+ type: :development
34
+ version_requirements: *id001
35
+ description: RSpec 2 library to make it simple to spec Rails 3 ActionView extensions
36
+ email: kmandrup@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.markdown
44
+ files:
45
+ - .document
46
+ - .gitignore
47
+ - .rspec
48
+ - LICENSE
49
+ - README.markdown
50
+ - Rakefile
51
+ - VERSION
52
+ - lib/rspec-action_view.rb
53
+ - rspec-action_view.gemspec
54
+ - spec/rspec-action_view_spec.rb
55
+ - spec/spec_helper.rb
56
+ has_rdoc: true
57
+ homepage: http://github.com/kristianmandrup/rspec-action_view
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options:
62
+ - --charset=UTF-8
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ requirements: []
82
+
83
+ rubyforge_project:
84
+ rubygems_version: 1.3.7
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: RSpec for Rails 3 ActionView extensions
88
+ test_files:
89
+ - spec/rspec-action_view_spec.rb
90
+ - spec/spec_helper.rb