refinerycms-core 0.9.9.19 → 0.9.9.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,142 @@
1
+ require "spec_helper"
2
+
3
+ module Refinery
4
+ module RefineryRspec
5
+ class Engine < ::Rails::Engine
6
+ ::Refinery::Plugin.register do |plugin|
7
+ plugin.name = "refinery_rspec"
8
+ end
9
+ end
10
+ end
11
+ end
12
+
13
+ module Refinery
14
+ describe Plugin do
15
+
16
+ let(:plugin) { Refinery::Plugins.registered.detect { |plugin| plugin.name == "refinery_rspec" } }
17
+
18
+ def setup_i18n
19
+ ::I18n.backend = ::I18n::Backend::Simple.new
20
+ ::I18n.backend.store_translations :en, :plugins => {
21
+ :refinery_rspec => {
22
+ :title => "RefineryCMS RSpec",
23
+ :description => "RSpec tests for plugin.rb"
24
+ }
25
+ }
26
+ end
27
+
28
+ describe ".register" do
29
+ it "must have a name" do
30
+ lambda { Plugin.register {} }.should raise_error
31
+ end
32
+ end
33
+
34
+ describe "#class_name" do
35
+ it "returns class name" do
36
+ plugin.class_name.should == "RefineryRspec"
37
+ end
38
+ end
39
+
40
+ describe "#title" do
41
+ before { setup_i18n }
42
+
43
+ it "returns plugin title defined by I18n" do
44
+ plugin.title.should == "RefineryCMS RSpec"
45
+ end
46
+ end
47
+
48
+ describe "#description" do
49
+ before { setup_i18n }
50
+
51
+ it "returns plugin description defined by I18n" do
52
+ plugin.description.should == "RSpec tests for plugin.rb"
53
+ end
54
+ end
55
+
56
+ describe "#activity" do
57
+
58
+ end
59
+
60
+ describe "#activity=" do
61
+
62
+ end
63
+
64
+ describe "#always_allow_access?" do
65
+ it "returns false if @always_allow_access is not set or its set to false" do
66
+ plugin.always_allow_access?.should be_false
67
+ end
68
+
69
+ it "returns true if set so" do
70
+ plugin.stub(:always_allow_access?).and_return(true)
71
+ plugin.always_allow_access?.should be
72
+ end
73
+ end
74
+
75
+ describe "#dashboard?" do
76
+ it "returns false if @dashboard is not set or its set to false" do
77
+ plugin.dashboard.should be_false
78
+ end
79
+
80
+ it "returns true if set so" do
81
+ plugin.stub(:dashboard).and_return(true)
82
+ plugin.dashboard.should be
83
+ end
84
+ end
85
+
86
+ describe "#menu_match" do
87
+ it "returns regexp based on plugin name" do
88
+ plugin.menu_match.should == /(admin|refinery)\/refinery_rspec$/
89
+ end
90
+ end
91
+
92
+ describe "#highlighted?" do
93
+ it "returns true if params[:controller] match menu_match regexp" do
94
+ plugin.highlighted?({:controller => "refinery/refinery_rspec"}).should be
95
+ end
96
+
97
+ it "returns true if dashboard? is true and params[:action] == error_404" do
98
+ plugin.stub(:dashboard?).and_return(true)
99
+ plugin.highlighted?({:action => "error_404"}).should be
100
+ end
101
+ end
102
+
103
+ describe "#url" do
104
+ class Plugin
105
+ def reset_url!
106
+ @url = nil
107
+ end
108
+ end
109
+
110
+ before(:each) { plugin.reset_url! }
111
+
112
+ context "when @url is already defined" do
113
+ it "returns hash" do
114
+ plugin.stub(:url).and_return({:controller => "/admin/testa"})
115
+ plugin.url.should == {:controller => "/admin/testa"}
116
+ end
117
+ end
118
+
119
+ context "when controller is present" do
120
+ it "returns hash based on it" do
121
+ plugin.stub(:controller).and_return("testb")
122
+ plugin.url.should == {:controller => "/admin/testb"}
123
+ end
124
+ end
125
+
126
+ context "when directory is present" do
127
+
128
+ it "returns hash based on it" do
129
+ plugin.stub(:directory).and_return("first/second/testc")
130
+ plugin.url.should == {:controller => "/admin/testc"}
131
+ end
132
+ end
133
+
134
+ context "when controller and directory not present" do
135
+ it "returns hash based on plugins name" do
136
+ plugin.url.should == {:controller => "/admin/refinery_rspec"}
137
+ end
138
+ end
139
+ end
140
+
141
+ end
142
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: refinerycms-core
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.9.19
5
+ version: 0.9.9.20
6
6
  platform: ruby
7
7
  authors:
8
8
  - Resolve Digital
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2011-04-22 00:00:00 Z
16
+ date: 2011-04-28 00:00:00 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: refinerycms-base
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirements:
24
24
  - - "="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.9.19
26
+ version: 0.9.9.20
27
27
  type: :runtime
28
28
  version_requirements: *id001
29
29
  - !ruby/object:Gem::Dependency
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - "="
36
36
  - !ruby/object:Gem::Version
37
- version: 0.9.9.19
37
+ version: 0.9.9.20
38
38
  type: :runtime
39
39
  version_requirements: *id002
40
40
  - !ruby/object:Gem::Dependency
@@ -441,6 +441,7 @@ files:
441
441
  - public/javascripts/wymeditor/lang/pt.js
442
442
  - public/javascripts/wymeditor/lang/rs.js
443
443
  - public/javascripts/wymeditor/lang/ru.js
444
+ - public/javascripts/wymeditor/lang/sk.js
444
445
  - public/javascripts/wymeditor/lang/sl.js
445
446
  - public/javascripts/wymeditor/lang/sv.js
446
447
  - public/javascripts/wymeditor/lang/tr.js
@@ -467,6 +468,7 @@ files:
467
468
  - public/wymeditor/MIT-license.txt
468
469
  - public/wymeditor/README
469
470
  - refinerycms-core.gemspec
471
+ - spec/lib/refinery/plugin_spec.rb
470
472
  - spec/lib/refinery/plugins_spec.rb
471
473
  homepage: http://refinerycms.com
472
474
  licenses:
@@ -497,3 +499,4 @@ specification_version: 3
497
499
  summary: Core engine for Refinery CMS
498
500
  test_files: []
499
501
 
502
+ has_rdoc: