rspec-cells 0.2.1 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed05686b72ee47371a5a7d6b5a50d7e0ab256b6a
4
- data.tar.gz: 7fcf7b3f409de782f98d2f3a8ec8f3641b94ca38
3
+ metadata.gz: c15cd7f3164970398e2a3848677d2da3b4c842a9
4
+ data.tar.gz: 264bee54540aaaa5455e6b9a6ed4c386e30e11f7
5
5
  SHA512:
6
- metadata.gz: 7d046919ad6c50ff2326bfb31c00d4238aabaa3e1c6d2fdfc94321c7bd48b75edb3a0ab3a9cba1cc17cb56157ea3e44f062c688ec49936f3a000fcffe13e1e9d
7
- data.tar.gz: 30ce8f0aa270760828eeefb4469acda3909a54ee8f9c931851ee5821dbe310730a3548f96164bebaaabc0acbb9bb0f3ba7867895910d7ca17cef82931959785e
6
+ metadata.gz: fb31b0a27be1796863f005389306856f7eff9cae2a48e236d3a2728ed3d34fd2f1d083a214f54485c9d4ee1a0d57559dbda6948bd5143b6671bc0829f6264646
7
+ data.tar.gz: 3500fb97930f1a40137112fc5d26857a76186e388b82e57cad754734835b30b36347901a725fdff99c40742004dbd33ffc9d7746441cff7ef002fb3ad61ed769
data/CHANGES.textile CHANGED
@@ -1,3 +1,7 @@
1
+ h2. 0.2.2
2
+
3
+ * Allow using `cell.stub(..)` with capybara.
4
+
1
5
  h2. 0.2.1
2
6
 
3
7
  * Relaxed rspec dependency to >= 2.14.
@@ -54,6 +54,11 @@ module RSpec::Rails
54
54
  return Capybara.string(content) if content.is_a?(String)
55
55
  content
56
56
  end
57
+
58
+ # TODO: test that properly.
59
+ def stub(*args)
60
+ @cell.stub(*args)
61
+ end
57
62
  end
58
63
  end
59
64
 
@@ -83,6 +88,11 @@ module RSpec::Rails
83
88
  end
84
89
 
85
90
  RSpec.configure do |c|
86
- c.include RSpec::Rails::CellExampleGroup, :file_path => /spec\/cells/
91
+ if RSpec::Core::Version::STRING.starts_with?("3")
92
+ c.include RSpec::Rails::CellExampleGroup, :file_path => /spec\/cells/
93
+ else
94
+ c.include RSpec::Rails::CellExampleGroup, :example_group => { :file_path => /spec\/cells/ }
95
+ end
96
+
87
97
  c.include RSpec::Rails::CellExampleGroup, :type => :cell
88
98
  end
@@ -1,6 +1,6 @@
1
1
  module RSpec
2
2
  module Cells
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
  end
5
5
  end
6
6
 
@@ -11,6 +11,12 @@ class DummyCell < Cell::Base
11
11
  end
12
12
  end
13
13
 
14
+ class SongCell < Cell::ViewModel
15
+ def show
16
+ "#{model}!"
17
+ end
18
+ end
19
+
14
20
 
15
21
  module RSpec::Rails
16
22
 
@@ -33,6 +39,19 @@ module RSpec::Rails
33
39
  it "allows passing state args" do
34
40
  expect(group.new.render_cell(:dummy, :update, "this")).to eq('Updating this.')
35
41
  end
42
+
43
+ # view model
44
+ # call state
45
+ it "allows rendering view model" do
46
+ expect(group.new.cell(:song, "Hangover").show).to eq("Hangover!")
47
+ end
48
+
49
+ # stubbing #cell
50
+ it do
51
+ cell = group.new.cell(:song, "Hangover")
52
+ cell.stub(:model => "Swarming Goblets")
53
+ expect(cell.show).to eq("Swarming Goblets!")
54
+ end
36
55
  end
37
56
 
38
57
  it "responds to #cell" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-cells
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-12 00:00:00.000000000 Z
11
+ date: 2014-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties