rspec-cells 0.0.1

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/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Dmytro Shteflyuk
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.rdoc ADDED
@@ -0,0 +1,44 @@
1
+ = Rspec Cells
2
+
3
+ <em>Spec your Cells.</em>
4
+
5
+ This plugin allows you to test your cells easily using RSpec. Basically, it adds a cells example group with a <tt>#render_cell</tt> helper.
6
+
7
+ Cells is Rails' popular {view components framework}[http://github.com/apotonick/cells].
8
+
9
+ = Installation
10
+
11
+ This gem runs with RSpec2 and Rails 3.0, so just add it to your app's +Gemfile+.
12
+
13
+ group :test do
14
+ gem "rspec-cells"
15
+
16
+
17
+ = Usage
18
+
19
+ Put all your specs under <tt>spec/cells</tt> folder. Here is how a simple spec could look like.
20
+
21
+ describe PostsCell do
22
+ render_views
23
+
24
+ it "should render the posts count" do
25
+ render_cell(:posts, :count).should have_selector("p", :content => "4 posts!")
26
+ end
27
+
28
+ end
29
+
30
+
31
+ Run your examples with
32
+
33
+ rake spec:cells
34
+
35
+ If you need more helpers, matchers and stuff, {just let us know}[http://cells.rubyforge.org/community.html].
36
+
37
+
38
+ == LICENSE
39
+
40
+ Copyright (c) 2010, Nick Sutterer
41
+
42
+ Copyright (c) 2007-2009, Dmytro Shteflyuk <kpumuk@kpumuk.info> http://kpumuk.info
43
+
44
+ Released under the MIT License.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,6 @@
1
+ namespace :spec do
2
+ desc "Run the code examples in spec/cells"
3
+ RSpec::Core::RakeTask.new("cells") do |t|
4
+ t.pattern = "./spec/cells/**/*_spec.rb"
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module RSpec # :nodoc:
2
+ module Cells # :nodoc:
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
6
+
@@ -0,0 +1,41 @@
1
+ module RSpec::Rails
2
+ # Lets you call #render_cell in Rspec2. Move your cell specs to <tt>spec/cells/</tt>.
3
+ module CellExampleGroup
4
+ VERSION = "0.0.1"
5
+
6
+ extend ActiveSupport::Concern
7
+ extend RSpec::Rails::ModuleInclusion
8
+
9
+ include RSpec::Rails::RailsExampleGroup
10
+ include Cell::TestCase::TestMethods
11
+ include RSpec::Rails::ViewRendering
12
+ include RSpec::Rails::BrowserSimulators
13
+
14
+ webrat do
15
+ include Webrat::Matchers
16
+ include Webrat::Methods
17
+ end
18
+
19
+ capybara do
20
+ include Capybara
21
+ end
22
+
23
+
24
+
25
+ module InstanceMethods
26
+ attr_reader :controller, :routes
27
+ end
28
+
29
+ included do
30
+ metadata[:type] = :cell
31
+ before do # called before every it.
32
+ @routes = ::Rails.application.routes
33
+ ActionController::Base.allow_forgery_protection = false
34
+ setup # defined in Cell::TestCase.
35
+ end
36
+ subject { controller }
37
+ end
38
+
39
+ RSpec.configure &include_self_when_dir_matches('spec','cells') # adds a filter to Configuration that includes this module in matching groups.
40
+ end
41
+ end
@@ -0,0 +1,13 @@
1
+ require 'rspec/rails'
2
+ require 'cell/test_case'
3
+ require 'rspec/rails/example/cell_example_group'
4
+
5
+ module RSpec
6
+ module Cells
7
+ class Railtie < ::Rails::Railtie
8
+ rake_tasks do
9
+ load "rspec/cells/tasks.rake"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "rspec/cells/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "rspec-cells"
7
+ s.version = RSpec::Cells::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Nick Sutterer"]
10
+ s.email = ["apotonick@gmail.com"]
11
+ s.homepage = "http://rubygems.org/gems/rspec-cells"
12
+ s.summary = %q{Spec your cells.}
13
+ s.description = %q{Use render_cell in your specs.}
14
+
15
+ s.rubyforge_project = "rspec-cells"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_runtime_dependency(%q<rails>, ["~> 3.0"])
23
+ s.add_runtime_dependency(%q<rspec-rails>, ["~> 2.2"])
24
+ s.add_runtime_dependency(%q<cells>, ["~> 3.4"])
25
+ end
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+
3
+ # wycats says...
4
+ require 'bundler'
5
+ Bundler.setup
6
+
7
+ $:.unshift File.dirname(__FILE__) # add current dir to LOAD_PATHS
8
+ require "rails/all"
9
+ require '../../lib/rspec-cells'
10
+
11
+ module RSpecCells
12
+ class Application < ::Rails::Application
13
+ end
14
+ end
15
+
16
+ module RSpec::Rails
17
+
18
+ describe CellExampleGroup do
19
+ let(:group) do
20
+ RSpec::Core::ExampleGroup.describe do
21
+ include CellExampleGroup
22
+ end
23
+ end
24
+
25
+ it "adds :type => :cell to the metadata" do
26
+ group.metadata[:type].should eq(:cell)
27
+ end
28
+
29
+ it "responds to #render_cell" do
30
+ group.new.should respond_to(:render_cell)
31
+ end
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-cells
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Nick Sutterer
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-12-11 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rails
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 3
30
+ - 0
31
+ version: "3.0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rspec-rails
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 2
44
+ - 2
45
+ version: "2.2"
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: cells
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 3
58
+ - 4
59
+ version: "3.4"
60
+ type: :runtime
61
+ version_requirements: *id003
62
+ description: Use render_cell in your specs.
63
+ email:
64
+ - apotonick@gmail.com
65
+ executables: []
66
+
67
+ extensions: []
68
+
69
+ extra_rdoc_files: []
70
+
71
+ files:
72
+ - Gemfile
73
+ - MIT-LICENSE
74
+ - README.rdoc
75
+ - Rakefile
76
+ - lib/rspec-cells.rb
77
+ - lib/rspec/cells/tasks.rake
78
+ - lib/rspec/cells/version.rb
79
+ - lib/rspec/rails/example/cell_example_group.rb
80
+ - rspec-cells.gemspec
81
+ - spec/cells/cell_spec_spec.rb
82
+ has_rdoc: true
83
+ homepage: http://rubygems.org/gems/rspec-cells
84
+ licenses: []
85
+
86
+ post_install_message:
87
+ rdoc_options: []
88
+
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ segments:
97
+ - 0
98
+ version: "0"
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ requirements: []
108
+
109
+ rubyforge_project: rspec-cells
110
+ rubygems_version: 1.3.7
111
+ signing_key:
112
+ specification_version: 3
113
+ summary: Spec your cells.
114
+ test_files: []
115
+