bread 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -4
  3. data/Rakefile +15 -19
  4. data/lib/bread/controller.rb +26 -0
  5. data/lib/bread/manager/actions.rb +1 -21
  6. data/lib/bread/manager/crumbs.rb +1 -16
  7. data/lib/bread/reloader.rb +30 -0
  8. data/lib/bread/version.rb +1 -1
  9. data/lib/bread.rb +12 -1
  10. data/lib/generators/bread/install_generator.rb +17 -2
  11. data/{test/dummy/app/lib → lib/generators/bread/templates}/bread/actions.rb +18 -18
  12. data/lib/generators/bread/templates/bread/crumbs.rb +20 -0
  13. data/lib/generators/bread/templates/view.html.erb +9 -0
  14. data/spec/controllers/photos_controller_spec.rb +94 -0
  15. data/spec/controllers/products_controller_spec.rb +94 -0
  16. data/{test → spec}/dummy/README.rdoc +0 -0
  17. data/{test → spec}/dummy/Rakefile +0 -0
  18. data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -0
  19. data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
  20. data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
  21. data/spec/dummy/app/controllers/photos_controller.rb +96 -0
  22. data/spec/dummy/app/controllers/products_controller.rb +98 -0
  23. data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
  24. data/spec/dummy/app/lib/bread/actions.rb +18 -0
  25. data/{test → spec}/dummy/app/lib/bread/crumbs.rb +26 -25
  26. data/spec/dummy/app/models/category.rb +7 -0
  27. data/spec/dummy/app/models/photo.rb +11 -0
  28. data/spec/dummy/app/models/product.rb +12 -0
  29. data/spec/dummy/app/views/layouts/application.html.erb +23 -0
  30. data/spec/dummy/app/views/photos/_form.html.erb +21 -0
  31. data/spec/dummy/app/views/photos/edit.html.erb +6 -0
  32. data/spec/dummy/app/views/photos/index.html.erb +25 -0
  33. data/spec/dummy/app/views/photos/new.html.erb +5 -0
  34. data/spec/dummy/app/views/photos/show.html.erb +9 -0
  35. data/{test → spec}/dummy/app/views/products/_form.html.erb +4 -4
  36. data/{test → spec}/dummy/app/views/products/edit.html.erb +0 -0
  37. data/{test → spec}/dummy/app/views/products/index.html.erb +1 -3
  38. data/{test → spec}/dummy/app/views/products/new.html.erb +0 -0
  39. data/{test → spec}/dummy/app/views/products/show.html.erb +0 -0
  40. data/{test → spec}/dummy/bin/bundle +0 -0
  41. data/{test → spec}/dummy/bin/rails +0 -0
  42. data/{test → spec}/dummy/bin/rake +0 -0
  43. data/{test → spec}/dummy/config/application.rb +8 -0
  44. data/{test → spec}/dummy/config/boot.rb +0 -0
  45. data/{test → spec}/dummy/config/database.yml +1 -3
  46. data/{test → spec}/dummy/config/environment.rb +0 -0
  47. data/{test → spec}/dummy/config/environments/development.rb +0 -0
  48. data/{test → spec}/dummy/config/environments/production.rb +0 -0
  49. data/{test → spec}/dummy/config/environments/test.rb +0 -1
  50. data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
  51. data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
  52. data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
  53. data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
  54. data/{test → spec}/dummy/config/initializers/secret_token.rb +1 -1
  55. data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
  56. data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
  57. data/{test → spec}/dummy/config/locales/en.yml +0 -0
  58. data/{test → spec}/dummy/config/routes.rb +1 -3
  59. data/{test → spec}/dummy/config.ru +0 -0
  60. data/{test → spec}/dummy/db/development.sqlite3 +0 -0
  61. data/spec/dummy/db/migrate/20140912040816_create_foos.rb +9 -0
  62. data/spec/dummy/db/migrate/20140912042735_create_admin_foos.rb +9 -0
  63. data/{test/dummy/db/migrate/20140203163238_create_products.rb → spec/dummy/db/migrate/20150312182743_create_products.rb} +1 -1
  64. data/spec/dummy/db/migrate/20150312182826_create_categories.rb +9 -0
  65. data/spec/dummy/db/migrate/20150312183119_create_photos.rb +10 -0
  66. data/{test/dummy/app/controllers/concerns/.keep → spec/dummy/db/production.sqlite3} +0 -0
  67. data/{test → spec}/dummy/db/schema.rb +22 -21
  68. data/{test → spec}/dummy/db/test.sqlite3 +0 -0
  69. data/spec/dummy/lib/templates/rails/scaffold_controller/controller.rb +101 -0
  70. data/spec/dummy/log/development.log +167 -0
  71. data/spec/dummy/log/production.log +66 -0
  72. data/spec/dummy/log/test.log +21931 -0
  73. data/{test → spec}/dummy/public/404.html +0 -0
  74. data/{test → spec}/dummy/public/422.html +0 -0
  75. data/{test → spec}/dummy/public/500.html +0 -0
  76. data/{test → spec}/dummy/public/favicon.ico +0 -0
  77. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  78. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  79. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  80. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  81. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  82. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  83. data/spec/rails_helper.rb +78 -0
  84. data/spec/requests/photos_spec.rb +12 -0
  85. data/spec/requests/products_spec.rb +11 -0
  86. data/spec/spec_helper.rb +85 -0
  87. data/spec/support/bread_spec_controller_methods.rb +11 -0
  88. data/spec/support/controllers/bread_spec_controller_methods.rb +12 -0
  89. metadata +254 -193
  90. data/.gitignore +0 -22
  91. data/Gemfile +0 -26
  92. data/LICENSE.txt +0 -22
  93. data/bread.gemspec +0 -24
  94. data/lib/bread/helper.rb +0 -16
  95. data/lib/generators/bread/templates/skeleton.rb +0 -12
  96. data/test/dummy/app/assets/javascripts/product_photos.js +0 -2
  97. data/test/dummy/app/assets/javascripts/products.js +0 -2
  98. data/test/dummy/app/assets/stylesheets/product_photos.css +0 -4
  99. data/test/dummy/app/assets/stylesheets/products.css +0 -4
  100. data/test/dummy/app/assets/stylesheets/scaffold.css +0 -56
  101. data/test/dummy/app/controllers/product_photos_controller.rb +0 -63
  102. data/test/dummy/app/controllers/products_controller.rb +0 -72
  103. data/test/dummy/app/helpers/product_photos_helper.rb +0 -2
  104. data/test/dummy/app/helpers/products_helper.rb +0 -2
  105. data/test/dummy/app/lib/bread/actions_next.rb +0 -43
  106. data/test/dummy/app/lib/bread/crumbs_next.rb +0 -77
  107. data/test/dummy/app/mailers/.keep +0 -0
  108. data/test/dummy/app/models/.keep +0 -0
  109. data/test/dummy/app/models/concerns/.keep +0 -0
  110. data/test/dummy/app/models/product.rb +0 -10
  111. data/test/dummy/app/models/product_photo.rb +0 -10
  112. data/test/dummy/app/models/user.rb +0 -6
  113. data/test/dummy/app/views/layouts/application.html.erb +0 -34
  114. data/test/dummy/app/views/product_photos/_form.html.erb +0 -25
  115. data/test/dummy/app/views/product_photos/edit.html.erb +0 -6
  116. data/test/dummy/app/views/product_photos/index.html.erb +0 -31
  117. data/test/dummy/app/views/product_photos/new.html.erb +0 -5
  118. data/test/dummy/app/views/product_photos/show.html.erb +0 -19
  119. data/test/dummy/config/breadcrumbs.rb +0 -18
  120. data/test/dummy/config/initializers/devise.rb +0 -254
  121. data/test/dummy/config/locales/devise.en.yml +0 -59
  122. data/test/dummy/db/migrate/20140306111733_devise_create_users.rb +0 -42
  123. data/test/dummy/db/migrate/20140306114935_create_product_photos.rb +0 -11
  124. data/test/dummy/lib/assets/.keep +0 -0
  125. data/test/dummy/lib/templates/rails/scaffold_controller/controller.rb +0 -146
  126. data/test/dummy/log/.keep +0 -0
  127. data/test/dummy/test/bread_test.rb +0 -7
  128. data/test/dummy/test/controllers/product_photos_controller_test.rb +0 -98
  129. data/test/dummy/test/controllers/products_controller_test.rb +0 -114
  130. data/test/dummy/test/fixtures/product_photos.yml +0 -11
  131. data/test/dummy/test/fixtures/products.yml +0 -9
  132. data/test/dummy/test/fixtures/users.yml +0 -11
  133. data/test/dummy/test/helpers/product_photos_helper_test.rb +0 -4
  134. data/test/dummy/test/helpers/products_helper_test.rb +0 -4
  135. data/test/dummy/test/integration/devise_test.rb +0 -166
  136. data/test/dummy/test/integration/navigation_test.rb +0 -10
  137. data/test/dummy/test/models/product_photo_test.rb +0 -7
  138. data/test/dummy/test/models/product_test.rb +0 -7
  139. data/test/dummy/test/models/user_test.rb +0 -7
  140. data/test/dummy/test/support/asserts.rb +0 -38
  141. data/test/dummy/test/support/others.rb +0 -20
  142. data/test/test_helper.rb +0 -21
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,78 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ SPEC_ROOT=File.dirname(__FILE__)
4
+ require 'spec_helper'
5
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
6
+ require 'rspec/rails'
7
+ # Add additional requires below this line. Rails is not loaded until this point!
8
+
9
+ require 'before_actions'
10
+
11
+
12
+ # Requires supporting ruby files with custom matchers and macros, etc, in
13
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
14
+ # run as spec files by default. This means that files in spec/support that end
15
+ # in _spec.rb will both be required and run as specs, causing the specs to be
16
+ # run twice. It is recommended that you do not name files matching this glob to
17
+ # end with _spec.rb. You can configure this pattern with the --pattern
18
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
19
+ #
20
+ # The following line is provided for convenience purposes. It has the downside
21
+ # of increasing the boot-up time by auto-requiring all files in the support
22
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
23
+ # require only the support files necessary.
24
+ #
25
+ Dir[File.join(SPEC_ROOT, "support/**/*.rb")].each { |f| require f }
26
+
27
+
28
+
29
+
30
+
31
+ #
32
+ # Multiple Gemfiles
33
+ #
34
+ puts "\e[0;35;49mTesting against Rails #{Rails::VERSION::STRING}\e[0m" #.magenta
35
+ # database: ":memory:"
36
+ puts "creating sqlite in memory database"
37
+ ActiveRecord::Schema.verbose = false
38
+ load "#{Rails.root}/db/schema.rb"
39
+
40
+
41
+
42
+ # Checks for pending migrations before tests are run.
43
+ # If you are not using ActiveRecord, you can remove this line.
44
+ # ActiveRecord::Migration.maintain_test_schema!
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+ RSpec.configure do |config|
54
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
55
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
56
+
57
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
58
+ # examples within a transaction, remove the following line or assign false
59
+ # instead of true.
60
+ config.use_transactional_fixtures = true
61
+
62
+ config.include BreadSpecControllerMethods, :type => :controller
63
+
64
+ # RSpec Rails can automatically mix in different behaviours to your tests
65
+ # based on their file location, for example enabling you to call `get` and
66
+ # `post` in specs under `spec/controllers`.
67
+ #
68
+ # You can disable this behaviour by removing the line below, and instead
69
+ # explicitly tag your specs with their type, e.g.:
70
+ #
71
+ # RSpec.describe UsersController, :type => :controller do
72
+ # # ...
73
+ # end
74
+ #
75
+ # The different available types are documented in the features, such as in
76
+ # https://relishapp.com/rspec/rspec-rails/docs
77
+ config.infer_spec_type_from_file_location!
78
+ end
@@ -0,0 +1,12 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "Photos", type: :request do
4
+ describe "GET /photos" do
5
+ it "works! (now write some real specs)" do
6
+ product_id = Product.create!(name: "Fake").id
7
+ get "/products/#{product_id}/photos.json"
8
+ expect(response).to have_http_status(200)
9
+ skip
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "Products", type: :request do
4
+ describe "GET /products" do
5
+ it "works! (now write some real specs)" do
6
+ get "/products.json"
7
+ expect(response).to have_http_status(200)
8
+ skip
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,85 @@
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, consider making
10
+ # a separate helper file that requires the additional dependencies and performs
11
+ # the additional setup, and require it from the spec files that actually need it.
12
+ #
13
+ # The `.rspec` file also contains a few flags that are not defaults but that
14
+ # users commonly want.
15
+ #
16
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+ RSpec.configure do |config|
18
+ # rspec-expectations config goes here. You can use an alternate
19
+ # assertion/expectation library such as wrong or the stdlib/minitest
20
+ # assertions if you prefer.
21
+ config.expect_with :rspec do |expectations|
22
+ # This option will default to `true` in RSpec 4. It makes the `description`
23
+ # and `failure_message` of custom matchers include text for helper methods
24
+ # defined using `chain`, e.g.:
25
+ # be_bigger_than(2).and_smaller_than(4).description
26
+ # # => "be bigger than 2 and smaller than 4"
27
+ # ...rather than:
28
+ # # => "be bigger than 2"
29
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
30
+ end
31
+
32
+ # rspec-mocks config goes here. You can use an alternate test double
33
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
34
+ config.mock_with :rspec do |mocks|
35
+ # Prevents you from mocking or stubbing a method that does not exist on
36
+ # a real object. This is generally recommended, and will default to
37
+ # `true` in RSpec 4.
38
+ mocks.verify_partial_doubles = true
39
+ end
40
+
41
+ # The settings below are suggested to provide a good initial experience
42
+ # with RSpec, but feel free to customize to your heart's content.
43
+ =begin
44
+ # These two settings work together to allow you to limit a spec run
45
+ # to individual examples or groups you care about by tagging them with
46
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
47
+ # get run.
48
+ config.filter_run :focus
49
+ config.run_all_when_everything_filtered = true
50
+
51
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
52
+ # For more details, see:
53
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
54
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
55
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
56
+ config.disable_monkey_patching!
57
+
58
+ # Many RSpec users commonly either run the entire suite or an individual
59
+ # file, and it's useful to allow more verbose output when running an
60
+ # individual spec file.
61
+ if config.files_to_run.one?
62
+ # Use the documentation formatter for detailed output,
63
+ # unless a formatter has already been configured
64
+ # (e.g. via a command-line flag).
65
+ config.default_formatter = 'doc'
66
+ end
67
+
68
+ # Print the 10 slowest examples and example groups at the
69
+ # end of the spec run, to help surface which specs are running
70
+ # particularly slow.
71
+ config.profile_examples = 10
72
+
73
+ # Run specs in random order to surface order dependencies. If you find an
74
+ # order dependency and want to debug it, you can fix the order by providing
75
+ # the seed, which is printed after each run.
76
+ # --seed 1234
77
+ config.order = :random
78
+
79
+ # Seed global randomization in this process using the `--seed` CLI option.
80
+ # Setting this allows you to use `--seed` to deterministically reproduce
81
+ # test failures related to randomization by passing the same `--seed` value
82
+ # as the one that triggered the failure.
83
+ Kernel.srand config.seed
84
+ =end
85
+ end
@@ -0,0 +1,11 @@
1
+ module BreadSpecControllerMethods
2
+
3
+ def bread_titles
4
+ controller.bread.map(&:title)
5
+ end
6
+
7
+ def bread_paths
8
+ controller.bread.map(&:path)
9
+ end
10
+
11
+ end
@@ -0,0 +1,12 @@
1
+ puts "uau".on_magenta
2
+ module BreadSpecControllerMethods
3
+
4
+ def bread_titles
5
+ controller.bread.map(&:title)
6
+ end
7
+
8
+ def bread_paths
9
+ controller.bread.map(&:path)
10
+ end
11
+
12
+ end