rspec-cells 0.1.1 → 0.1.2

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/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  Gemfile.lock
3
3
  *.gem
4
4
  /.rvmrc
5
+ spec/tmp
data/CHANGES.textile CHANGED
@@ -1,3 +1,7 @@
1
+ h2. 0.1.2
2
+
3
+ * No more deprecation warnings in Rails 3.2.
4
+
1
5
  h2. 0.1.1
2
6
 
3
7
  * Fixed indentation in generator. Thanks to Richard Huang [flyerhzm].
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
-
5
- gem 'cells', :path => "../cells"
data/README.rdoc CHANGED
@@ -10,7 +10,7 @@ Cells is Rails' popular {view components framework}[http://github.com/apotonick/
10
10
 
11
11
  = Installation
12
12
 
13
- This gem runs with RSpec2 and Rails 3.0, so just add it to your app's +Gemfile+.
13
+ This gem runs with RSpec2 and Rails 3.x, so just add it to your app's +Gemfile+.
14
14
 
15
15
  group :test do
16
16
  gem "rspec-cells"
@@ -66,7 +66,7 @@ You can then use capybara's matchers in your cell spec.
66
66
  end
67
67
  end
68
68
 
69
- You can see all capybara matchers and finders here: http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Simple
69
+ You can see all capybara matchers and finders {here}[http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Simple].
70
70
 
71
71
  == Running the specs
72
72
 
@@ -1,6 +1,6 @@
1
1
  module RSpec # :nodoc:
2
2
  module Cells # :nodoc:
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
6
6
 
@@ -39,16 +39,14 @@ module RSpec::Rails
39
39
  end
40
40
  end
41
41
 
42
- module InstanceMethods
43
- attr_reader :controller, :routes
42
+ attr_reader :controller, :routes
44
43
 
45
- def method_missing(method, *args, &block)
46
- # Send the route helpers to the application router.
47
- if @routes && @routes.named_routes.helpers.include?(method)
48
- @controller.send(method, *args, &block)
49
- else
50
- super
51
- end
44
+ def method_missing(method, *args, &block)
45
+ # Send the route helpers to the application router.
46
+ if @routes && @routes.named_routes.helpers.include?(method)
47
+ @controller.send(method, *args, &block)
48
+ else
49
+ super
52
50
  end
53
51
  end
54
52
 
data/rspec-cells.gemspec CHANGED
@@ -21,5 +21,5 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.add_runtime_dependency(%q<rails>, ["~> 3.0"])
23
23
  s.add_runtime_dependency(%q<rspec-rails>, ["~> 2.2"])
24
- #s.add_runtime_dependency(%q<cells>, ["~> 3.4"])
24
+ s.add_runtime_dependency(%q<cells>, ["~> 3.4"])
25
25
  end
@@ -0,0 +1,58 @@
1
+ require "spec_helper"
2
+ require "generators/rspec/cell_generator"
3
+
4
+ describe Rspec::Generators::CellGenerator do
5
+ include RSpec::Rails::RailsExampleGroup
6
+
7
+ attr_accessor :test_case, :test
8
+
9
+ DESTINATION_ROOT = File.expand_path("../../tmp", __FILE__)
10
+
11
+ before(:all) do
12
+ test_case = Class.new(Rails::Generators::TestCase)
13
+ test_case.destination_root = DESTINATION_ROOT
14
+ test_case.generator_class = Rspec::Generators::CellGenerator
15
+ self.test = test_case.new :wow
16
+ test.run_generator %w(Twitter display form)
17
+ end
18
+
19
+ # Cleanup after we are done testing
20
+ after(:all) do
21
+ FileUtils.rm_rf(DESTINATION_ROOT)
22
+ end
23
+
24
+ def t(line_code)
25
+ Regexp.new(Regexp.escape(line_code))
26
+ end
27
+
28
+ it "creates widget spec" do
29
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t("require 'spec_helper'")
30
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('describe TwitterCell do')
31
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('context "cell rendering" do')
32
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('end')
33
+ end
34
+
35
+ it 'creates display state' do
36
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('context "rendering display" do')
37
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('subject { render_cell(:twitter, :display) }')
38
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('it { should have_selector("h1", :content => "Twitter#display") }')
39
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('it { should have_selector("p", :content => "Find me in app/cells/twitter/display.html") }')
40
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('end')
41
+ end
42
+
43
+ it 'creates form state' do
44
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('context "rendering form" do')
45
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('subject { render_cell(:twitter, :form) }')
46
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('it { should have_selector("h1", :content => "Twitter#form") }')
47
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('it { should have_selector("p", :content => "Find me in app/cells/twitter/form.html") }')
48
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('end')
49
+ end
50
+
51
+ it 'creates respond_to states specs' do
52
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('context "cell instance" do ')
53
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('subject { cell(:twitter) } ')
54
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('it { should respond_to(:display) }')
55
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('it { should respond_to(:form) }')
56
+ test.assert_file "spec/cells/twitter_cell_spec.rb", t('end')
57
+ end
58
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,5 @@
1
- require 'rubygems'
2
-
3
- # wycats says...
4
- require 'bundler'
5
- Bundler.setup
1
+ require 'rubygems' unless defined?(Gem)
2
+ require 'bundler/setup'
6
3
 
7
4
  #$:.unshift File.dirname(__FILE__) # add current dir to LOAD_PATHS
8
5
  require "rails/all"
@@ -11,7 +8,6 @@ require 'rspec/rails'
11
8
  require 'cell/test_case'
12
9
  require 'rspec/rails/example/cell_example_group'
13
10
 
14
-
15
11
  module RSpecCells
16
12
  class Application < ::Rails::Application
17
13
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nick Sutterer
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-12-19 00:00:00 +01:00
17
+ date: 2012-01-27 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -45,6 +45,20 @@ dependencies:
45
45
  version: "2.2"
46
46
  type: :runtime
47
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
48
62
  description: Use render_cell in your specs.
49
63
  email:
50
64
  - apotonick@gmail.com
@@ -70,6 +84,7 @@ files:
70
84
  - lib/rspec/cells/version.rb
71
85
  - lib/rspec/rails/example/cell_example_group.rb
72
86
  - rspec-cells.gemspec
87
+ - spec/cells/cell_generator_spec.rb
73
88
  - spec/cells/cell_spec_spec.rb
74
89
  - spec/spec_helper.rb
75
90
  has_rdoc: true