dorsale 1.0.0

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.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +31 -0
  5. data/app/assets/javascripts/dorsale/addresses.js +2 -0
  6. data/app/assets/javascripts/dorsale/application.js +13 -0
  7. data/app/assets/stylesheets/dorsale/addresses.css +4 -0
  8. data/app/assets/stylesheets/dorsale/application.css +13 -0
  9. data/app/assets/stylesheets/scaffold.css +56 -0
  10. data/app/controllers/dorsale/addresses_controller.rb +62 -0
  11. data/app/controllers/dorsale/application_controller.rb +4 -0
  12. data/app/helpers/dorsale/addresses_helper.rb +4 -0
  13. data/app/helpers/dorsale/application_helper.rb +4 -0
  14. data/app/models/dorsale/address.rb +10 -0
  15. data/app/views/dorsale/addresses/_form.html.slim +24 -0
  16. data/app/views/dorsale/addresses/edit.html.slim +8 -0
  17. data/app/views/dorsale/addresses/index.html.slim +29 -0
  18. data/app/views/dorsale/addresses/new.html.slim +5 -0
  19. data/app/views/dorsale/addresses/show.html.slim +21 -0
  20. data/config/routes.rb +4 -0
  21. data/db/migrate/20141010140200_create_dorsale_addresses.rb +13 -0
  22. data/db/migrate/20141014072756_add_polymorphic_fields_to_addresses.rb +6 -0
  23. data/lib/dorsale.rb +4 -0
  24. data/lib/dorsale/engine.rb +12 -0
  25. data/lib/dorsale/version.rb +3 -0
  26. data/lib/tasks/dorsale_tasks.rake +4 -0
  27. data/spec/controllers/dorsale/addresses_controller_spec.rb +162 -0
  28. data/spec/dummy/README.rdoc +28 -0
  29. data/spec/dummy/Rakefile +6 -0
  30. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  31. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  32. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  33. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  34. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  35. data/spec/dummy/bin/bundle +3 -0
  36. data/spec/dummy/bin/rails +4 -0
  37. data/spec/dummy/bin/rake +4 -0
  38. data/spec/dummy/config.ru +4 -0
  39. data/spec/dummy/config/application.rb +28 -0
  40. data/spec/dummy/config/boot.rb +5 -0
  41. data/spec/dummy/config/database.yml +25 -0
  42. data/spec/dummy/config/environment.rb +5 -0
  43. data/spec/dummy/config/environments/development.rb +32 -0
  44. data/spec/dummy/config/environments/production.rb +80 -0
  45. data/spec/dummy/config/environments/test.rb +39 -0
  46. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  47. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  48. data/spec/dummy/config/initializers/inflections.rb +16 -0
  49. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  50. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  51. data/spec/dummy/config/initializers/session_store.rb +3 -0
  52. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  53. data/spec/dummy/config/locales/en.yml +23 -0
  54. data/spec/dummy/config/routes.rb +4 -0
  55. data/spec/dummy/db/development.sqlite3 +0 -0
  56. data/spec/dummy/db/schema.rb +28 -0
  57. data/spec/dummy/db/test.sqlite3 +0 -0
  58. data/spec/dummy/log/development.log +27 -0
  59. data/spec/dummy/log/test.log +2937 -0
  60. data/spec/dummy/public/404.html +58 -0
  61. data/spec/dummy/public/422.html +58 -0
  62. data/spec/dummy/public/500.html +57 -0
  63. data/spec/dummy/public/favicon.ico +0 -0
  64. data/spec/factories/dorsale_addresses.rb +11 -0
  65. data/spec/helpers/dorsale/addresses_helper_spec.rb +16 -0
  66. data/spec/models/dorsale/address_spec.rb +36 -0
  67. data/spec/rails_helper.rb +58 -0
  68. data/spec/routing/dorsale/addresses_routing_spec.rb +38 -0
  69. data/spec/spec_helper.rb +86 -0
  70. data/spec/views/dorsale/addresses/edit.html.slim_spec.rb +32 -0
  71. data/spec/views/dorsale/addresses/index.html.slim_spec.rb +32 -0
  72. data/spec/views/dorsale/addresses/new.html.slim_spec.rb +32 -0
  73. data/spec/views/dorsale/addresses/show.html.slim_spec.rb +24 -0
  74. metadata +260 -0
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,11 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :dorsale_address, :class => 'Dorsale::Address' do
5
+ street "3 Rue Marx Dormoy"
6
+ street_bis ""
7
+ city "Marseille"
8
+ zip "13004"
9
+ country "France"
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ require 'rails_helper'
2
+
3
+ # Specs in this file have access to a helper object that includes
4
+ # the AddressesHelper. For example:
5
+ #
6
+ # describe AddressesHelper do
7
+ # describe "string concat" do
8
+ # it "concats two strings with spaces" do
9
+ # expect(helper.concat_strings("this","that")).to eq("this that")
10
+ # end
11
+ # end
12
+ # end
13
+ module Dorsale
14
+ RSpec.describe AddressesHelper, :type => :helper do
15
+ end
16
+ end
@@ -0,0 +1,36 @@
1
+ require 'rails_helper'
2
+
3
+ module Dorsale
4
+ RSpec.describe Address, :type => :model do
5
+ it {should validate_presence_of :city}
6
+ it {should belong_to :addressable}
7
+ describe '#one_line' do
8
+ it 'should build a one line address' do
9
+ address = Address.create(street: '3 Rue Marx Dormoy',
10
+ street_bis: 'L\'atelier',
11
+ zip: '13004',
12
+ city: 'Marseille',
13
+ country: 'France')
14
+ expect(address.one_line).to eq('3 Rue Marx Dormoy, L\'atelier, 13004 Marseille, France')
15
+ end
16
+
17
+ it 'should remove useless commas' do
18
+ address = Address.create(street: '3 Rue Marx Dormoy',
19
+ street_bis: '',
20
+ zip: '13004',
21
+ city: 'Marseille',
22
+ country: '')
23
+ expect(address.one_line).to eq('3 Rue Marx Dormoy, 13004 Marseille')
24
+ end
25
+
26
+ it 'should remove useless commas' do
27
+ address = Address.create(street: '3 Rue Marx Dormoy',
28
+ street_bis: '',
29
+ zip: '',
30
+ city: 'Marseille',
31
+ country: '')
32
+ expect(address.one_line).to eq('3 Rue Marx Dormoy, Marseille')
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,58 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require 'spec_helper'
4
+ require File.expand_path("../dummy/config/environment", __FILE__)
5
+ require 'rspec/rails'
6
+
7
+ require 'factory_girl_rails'
8
+ require 'slim'
9
+ Rails.backtrace_cleaner.remove_silencers!
10
+ # Load support files
11
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
12
+
13
+
14
+ # Add additional requires below this line. Rails is not loaded until this point!
15
+
16
+ # Requires supporting ruby files with custom matchers and macros, etc, in
17
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
18
+ # run as spec files by default. This means that files in spec/support that end
19
+ # in _spec.rb will both be required and run as specs, causing the specs to be
20
+ # run twice. It is recommended that you do not name files matching this glob to
21
+ # end with _spec.rb. You can configure this pattern with the --pattern
22
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
23
+ #
24
+ # The following line is provided for convenience purposes. It has the downside
25
+ # of increasing the boot-up time by auto-requiring all files in the support
26
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
27
+ # require only the support files necessary.
28
+ #
29
+ # Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
30
+
31
+ # Checks for pending migrations before tests are run.
32
+ # If you are not using ActiveRecord, you can remove this line.
33
+ ActiveRecord::Migration.check_pending!
34
+
35
+ RSpec.configure do |config|
36
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
37
+ # config.fixture_path = "#{::Rails.root}/spec/fixtures"
38
+
39
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
40
+ # examples within a transaction, remove the following line or assign false
41
+ # instead of true.
42
+ config.use_transactional_fixtures = true
43
+
44
+ # RSpec Rails can automatically mix in different behaviours to your tests
45
+ # based on their file location, for example enabling you to call `get` and
46
+ # `post` in specs under `spec/controllers`.
47
+ #
48
+ # You can disable this behaviour by removing the line below, and instead
49
+ # explicitly tag your specs with their type, e.g.:
50
+ #
51
+ # RSpec.describe UsersController, :type => :controller do
52
+ # # ...
53
+ # end
54
+ #
55
+ # The different available types are documented in the features, such as in
56
+ # https://relishapp.com/rspec/rspec-rails/docs
57
+ config.infer_spec_type_from_file_location!
58
+ end
@@ -0,0 +1,38 @@
1
+ require "rails_helper"
2
+
3
+ module Dorsale
4
+ RSpec.describe AddressesController, :type => :routing do
5
+ routes { Dorsale::Engine.routes }
6
+ describe "routing" do
7
+
8
+ it "routes to #index" do
9
+ expect(:get => "/addresses").to route_to("dorsale/addresses#index")
10
+ end
11
+
12
+ it "routes to #new" do
13
+ expect(:get => "/addresses/new").to route_to("dorsale/addresses#new")
14
+ end
15
+
16
+ it "routes to #show" do
17
+ expect(:get => "/addresses/1").to route_to("dorsale/addresses#show", :id => "1")
18
+ end
19
+
20
+ it "routes to #edit" do
21
+ expect(:get => "/addresses/1/edit").to route_to("dorsale/addresses#edit", :id => "1")
22
+ end
23
+
24
+ it "routes to #create" do
25
+ expect(:post => "/addresses").to route_to("dorsale/addresses#create")
26
+ end
27
+
28
+ it "routes to #update" do
29
+ expect(:put => "/addresses/1").to route_to("dorsale/addresses#update", :id => "1")
30
+ end
31
+
32
+ it "routes to #destroy" do
33
+ expect(:delete => "/addresses/1").to route_to("dorsale/addresses#destroy", :id => "1")
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,86 @@
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
+
18
+ RSpec.configure do |config|
19
+ # rspec-expectations config goes here. You can use an alternate
20
+ # assertion/expectation library such as wrong or the stdlib/minitest
21
+ # assertions if you prefer.
22
+ config.expect_with :rspec do |expectations|
23
+ # This option will default to `true` in RSpec 4. It makes the `description`
24
+ # and `failure_message` of custom matchers include text for helper methods
25
+ # defined using `chain`, e.g.:
26
+ # be_bigger_than(2).and_smaller_than(4).description
27
+ # # => "be bigger than 2 and smaller than 4"
28
+ # ...rather than:
29
+ # # => "be bigger than 2"
30
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
31
+ end
32
+
33
+ # rspec-mocks config goes here. You can use an alternate test double
34
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
35
+ config.mock_with :rspec do |mocks|
36
+ # Prevents you from mocking or stubbing a method that does not exist on
37
+ # a real object. This is generally recommended, and will default to
38
+ # `true` in RSpec 4.
39
+ mocks.verify_partial_doubles = true
40
+ end
41
+
42
+ # The settings below are suggested to provide a good initial experience
43
+ # with RSpec, but feel free to customize to your heart's content.
44
+ =begin
45
+ # These two settings work together to allow you to limit a spec run
46
+ # to individual examples or groups you care about by tagging them with
47
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
48
+ # get run.
49
+ config.filter_run :focus
50
+ config.run_all_when_everything_filtered = true
51
+
52
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
53
+ # For more details, see:
54
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
55
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
56
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
57
+ config.disable_monkey_patching!
58
+
59
+ # Many RSpec users commonly either run the entire suite or an individual
60
+ # file, and it's useful to allow more verbose output when running an
61
+ # individual spec file.
62
+ if config.files_to_run.one?
63
+ # Use the documentation formatter for detailed output,
64
+ # unless a formatter has already been configured
65
+ # (e.g. via a command-line flag).
66
+ config.default_formatter = 'doc'
67
+ end
68
+
69
+ # Print the 10 slowest examples and example groups at the
70
+ # end of the spec run, to help surface which specs are running
71
+ # particularly slow.
72
+ config.profile_examples = 10
73
+
74
+ # Run specs in random order to surface order dependencies. If you find an
75
+ # order dependency and want to debug it, you can fix the order by providing
76
+ # the seed, which is printed after each run.
77
+ # --seed 1234
78
+ config.order = :random
79
+
80
+ # Seed global randomization in this process using the `--seed` CLI option.
81
+ # Setting this allows you to use `--seed` to deterministically reproduce
82
+ # test failures related to randomization by passing the same `--seed` value
83
+ # as the one that triggered the failure.
84
+ Kernel.srand config.seed
85
+ =end
86
+ end
@@ -0,0 +1,32 @@
1
+ require 'rails_helper'
2
+
3
+ module Dorsale
4
+ RSpec.describe "dorsale/addresses/edit", :type => :view do
5
+ before(:each) do
6
+ @address = assign(:address, Address.create!(
7
+ :street => "MyString",
8
+ :street_bis => "MyString",
9
+ :city => "MyString",
10
+ :zip => "MyString",
11
+ :country => "MyString"
12
+ ))
13
+ end
14
+
15
+ it "renders the edit address form" do
16
+ render
17
+
18
+ assert_select "form[action=?][method=?]", dorsale.address_path(@address), "post" do
19
+
20
+ assert_select "input#address_street[name=?]", "address[street]"
21
+
22
+ assert_select "input#address_street_bis[name=?]", "address[street_bis]"
23
+
24
+ assert_select "input#address_city[name=?]", "address[city]"
25
+
26
+ assert_select "input#address_zip[name=?]", "address[zip]"
27
+
28
+ assert_select "input#address_country[name=?]", "address[country]"
29
+ end
30
+ end
31
+ end
32
+ end