bushido 0.0.34 → 0.0.35
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bushido/middleware.rb +2 -0
- data/lib/bushido/version.rb +1 -1
- data/lib/engine.rb +0 -2
- data/test_app/Gemfile +1 -0
- data/test_app/app/controllers/static_controller.rb +4 -0
- data/test_app/app/helpers/static_helper.rb +2 -0
- data/test_app/app/views/static/home.html.erb +1 -0
- data/test_app/config/routes.rb +3 -0
- data/test_app/spec/helpers/static_helper_spec.rb +14 -0
- data/test_app/spec/integration/app_claim_spec.rb +18 -0
- data/test_app/spec/spec_helper.rb +23 -1
- data/test_app/spec/support/integration_example_group.rb +35 -0
- metadata +14 -2
data/lib/bushido/middleware.rb
CHANGED
data/lib/bushido/version.rb
CHANGED
data/lib/engine.rb
CHANGED
data/test_app/Gemfile
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
Homepage
|
data/test_app/config/routes.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Specs in this file have access to a helper object that includes
|
4
|
+
# the StaticHelper. For example:
|
5
|
+
#
|
6
|
+
# describe StaticHelper do
|
7
|
+
# describe "string concat" do
|
8
|
+
# it "concats two strings with spaces" do
|
9
|
+
# helper.concat_strings("this","that").should == "this that"
|
10
|
+
# end
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
describe StaticHelper do
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'claiming an app' do
|
4
|
+
it "marks claimed = false in the markup" do
|
5
|
+
visit "/home"
|
6
|
+
|
7
|
+
page.body.include?("var _bushido_claimed = false;").should be_true
|
8
|
+
end
|
9
|
+
|
10
|
+
it "marks claimed = false in the markup" do
|
11
|
+
preserve_envs("BUSHIDO_CLAIMED") do
|
12
|
+
ENV["BUSHIDO_CLAIMED"] = "true"
|
13
|
+
visit "/home"
|
14
|
+
|
15
|
+
page.body.include?("var _bushido_claimed = true;").should be_true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,9 +1,19 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
1
|
+
#require File.expand_path('../boot', __FILE__)
|
2
|
+
require File.expand_path("../../config/environment", __FILE__)
|
3
|
+
require 'rspec/rails'
|
4
|
+
|
5
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
6
|
+
# in spec/support/ and its subdirectories.
|
7
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
2
8
|
|
3
9
|
require "action_controller/railtie"
|
4
10
|
require "action_mailer/railtie"
|
5
11
|
require "active_resource/railtie"
|
6
12
|
|
13
|
+
# Add this to load Capybara integration:
|
14
|
+
require 'capybara/rspec'
|
15
|
+
require 'capybara/rails'
|
16
|
+
|
7
17
|
# If you have a Gemfile, require the gems listed there, including any gems
|
8
18
|
# you've limited to :test, :development, or :production.
|
9
19
|
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
@@ -42,3 +52,15 @@ module TestApp
|
|
42
52
|
config.filter_parameters += [:password]
|
43
53
|
end
|
44
54
|
end
|
55
|
+
|
56
|
+
|
57
|
+
def preserve_envs(*keys, &block)
|
58
|
+
cache = {}
|
59
|
+
keys.each { |key| cache[key] = ENV[key] }
|
60
|
+
|
61
|
+
begin
|
62
|
+
yield
|
63
|
+
ensure
|
64
|
+
keys.each { |key| ENV[key] = cache[key] }
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'action_dispatch'
|
2
|
+
require 'capybara/rails'
|
3
|
+
require 'capybara/dsl'
|
4
|
+
|
5
|
+
module RSpec::Rails
|
6
|
+
module IntegrationExampleGroup
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
include ActionDispatch::Integration::Runner
|
10
|
+
include RSpec::Rails::TestUnitAssertionAdapter
|
11
|
+
include ActionDispatch::Assertions
|
12
|
+
include Capybara::DSL
|
13
|
+
include RSpec::Matchers
|
14
|
+
|
15
|
+
module InstanceMethods
|
16
|
+
def app
|
17
|
+
::Rails.application
|
18
|
+
end
|
19
|
+
|
20
|
+
def last_response
|
21
|
+
page
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
included do
|
26
|
+
before do
|
27
|
+
@router = ::Rails.application.routes
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
RSpec.configure do |c|
|
32
|
+
c.include self, :example_group => { :file_path => /\bspec\/integration\// }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: bushido
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.35
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sean Grove
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-07-
|
14
|
+
date: 2011-07-27 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -112,8 +112,11 @@ files:
|
|
112
112
|
- test_app/README
|
113
113
|
- test_app/Rakefile
|
114
114
|
- test_app/app/controllers/application_controller.rb
|
115
|
+
- test_app/app/controllers/static_controller.rb
|
115
116
|
- test_app/app/helpers/application_helper.rb
|
117
|
+
- test_app/app/helpers/static_helper.rb
|
116
118
|
- test_app/app/views/layouts/application.html.erb
|
119
|
+
- test_app/app/views/static/home.html.erb
|
117
120
|
- test_app/config.ru
|
118
121
|
- test_app/config/application.rb
|
119
122
|
- test_app/config/boot.rb
|
@@ -149,7 +152,10 @@ files:
|
|
149
152
|
- test_app/public/stylesheets/.gitkeep
|
150
153
|
- test_app/script/rails
|
151
154
|
- test_app/spec/controllers/envs_controller_spec.rb
|
155
|
+
- test_app/spec/helpers/static_helper_spec.rb
|
156
|
+
- test_app/spec/integration/app_claim_spec.rb
|
152
157
|
- test_app/spec/spec_helper.rb
|
158
|
+
- test_app/spec/support/integration_example_group.rb
|
153
159
|
- test_app/test/performance/browsing_test.rb
|
154
160
|
- test_app/test/test_helper.rb
|
155
161
|
- test_app/vendor/plugins/.gitkeep
|
@@ -189,8 +195,11 @@ test_files:
|
|
189
195
|
- test_app/README
|
190
196
|
- test_app/Rakefile
|
191
197
|
- test_app/app/controllers/application_controller.rb
|
198
|
+
- test_app/app/controllers/static_controller.rb
|
192
199
|
- test_app/app/helpers/application_helper.rb
|
200
|
+
- test_app/app/helpers/static_helper.rb
|
193
201
|
- test_app/app/views/layouts/application.html.erb
|
202
|
+
- test_app/app/views/static/home.html.erb
|
194
203
|
- test_app/config.ru
|
195
204
|
- test_app/config/application.rb
|
196
205
|
- test_app/config/boot.rb
|
@@ -226,7 +235,10 @@ test_files:
|
|
226
235
|
- test_app/public/stylesheets/.gitkeep
|
227
236
|
- test_app/script/rails
|
228
237
|
- test_app/spec/controllers/envs_controller_spec.rb
|
238
|
+
- test_app/spec/helpers/static_helper_spec.rb
|
239
|
+
- test_app/spec/integration/app_claim_spec.rb
|
229
240
|
- test_app/spec/spec_helper.rb
|
241
|
+
- test_app/spec/support/integration_example_group.rb
|
230
242
|
- test_app/test/performance/browsing_test.rb
|
231
243
|
- test_app/test/test_helper.rb
|
232
244
|
- test_app/vendor/plugins/.gitkeep
|