catarse_monkeymail 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.rspec +2 -0
  4. data/Gemfile +0 -4
  5. data/Gemfile.lock +19 -451
  6. data/Rakefile +1 -1
  7. data/app/models/catarse_monkeymail/user_concern.rb +0 -1
  8. data/catarse_monkeymail.gemspec +3 -1
  9. data/lib/catarse_monkeymail/version.rb +1 -1
  10. data/spec/controller/catarse_monkeymail/controller_concerns_spec.rb +14 -0
  11. data/spec/dummy/README.rdoc +261 -0
  12. data/spec/dummy/Rakefile +7 -0
  13. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  14. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  15. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  16. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  17. data/spec/dummy/app/mailers/.gitkeep +0 -0
  18. data/spec/dummy/app/models/.gitkeep +0 -0
  19. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  20. data/spec/dummy/config.ru +4 -0
  21. data/spec/dummy/config/application.rb +23 -0
  22. data/spec/dummy/config/boot.rb +10 -0
  23. data/spec/dummy/config/database.yml +50 -0
  24. data/spec/dummy/config/environment.rb +5 -0
  25. data/spec/dummy/config/environments/development.rb +29 -0
  26. data/spec/dummy/config/environments/production.rb +80 -0
  27. data/spec/dummy/config/environments/test.rb +36 -0
  28. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  29. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  30. data/spec/dummy/config/initializers/inflections.rb +16 -0
  31. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  32. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  33. data/spec/dummy/config/initializers/session_store.rb +3 -0
  34. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  35. data/spec/dummy/config/locales/en.yml +5 -0
  36. data/spec/dummy/config/routes.rb +2 -0
  37. data/spec/dummy/lib/assets/.gitkeep +0 -0
  38. data/spec/dummy/log/.gitkeep +0 -0
  39. data/spec/dummy/public/404.html +26 -0
  40. data/spec/dummy/public/422.html +26 -0
  41. data/spec/dummy/public/500.html +25 -0
  42. data/spec/dummy/public/favicon.ico +0 -0
  43. data/spec/dummy/script/rails +6 -0
  44. data/spec/dummy/tmp/cache/A5C/C50/%2Fconfigurations%2Fa_config +1 -0
  45. data/spec/dummy/tmp/cache/C1D/B20/%2Fconfigurations%2Fother_config +1 -0
  46. data/spec/dummy/tmp/cache/DC7/960/%2Fconfigurations%2Fnot_found_config +1 -0
  47. data/spec/models/catarse_monkeymail/project_spec.rb +11 -11
  48. data/spec/models/catarse_monkeymail/user_spec.rb +14 -14
  49. data/spec/spec_helper.rb +16 -78
  50. data/spec/support/project.rb +3 -0
  51. data/spec/support/user.rb +2 -0
  52. metadata +112 -8
  53. data/app/controllers/catarse_monkeymail/application_controller.rb +0 -4
  54. data/bin/rails +0 -12
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,29 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+ end
@@ -0,0 +1,80 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = false
24
+
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
47
+
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+ # config.action_controller.asset_host = "http://assets.example.com"
59
+
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ # config.assets.precompile += %w( search.js )
63
+
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+ # config.action_mailer.raise_delivery_errors = false
67
+
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation can not be found).
70
+ config.i18n.fallbacks = true
71
+
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
74
+
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
80
+ end
@@ -0,0 +1,36 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static asset server for tests with Cache-Control for performance.
16
+ config.serve_static_assets = true
17
+ config.static_cache_control = "public, max-age=3600"
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
28
+
29
+ # Tell Action Mailer not to deliver emails to the real world.
30
+ # The :test delivery method accumulates sent emails in the
31
+ # ActionMailer::Base.deliveries array.
32
+ config.action_mailer.delivery_method = :test
33
+
34
+ # Print deprecation notices to the stderr.
35
+ config.active_support.deprecation = :stderr
36
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,12 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure your secret_key_base is kept private
11
+ # if you're sharing your code publicly.
12
+ Dummy::Application.config.secret_key_base = '56b32f3c2786d84f9dc2a481c726e5a6675e0466e0bd7031322d20df94ec5010c8a488a29f4f0856a10bb02b4117f80ac70429f9926efe0583a1472857bb6421'
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end
File without changes
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1 @@
1
+ o: ActiveSupport::Cache::Entry: @valueI" a_value:ET:@created_atf1397152563.256214:@expires_in0
@@ -0,0 +1 @@
1
+ o: ActiveSupport::Cache::Entry: @valueI"another_value:ET:@created_atf1397152563.293689:@expires_in0
@@ -0,0 +1 @@
1
+ o: ActiveSupport::Cache::Entry: @value0:@created_atf1397152563.284907:@expires_in0
@@ -2,31 +2,31 @@ require 'spec_helper'
2
2
 
3
3
  describe Project do
4
4
  before do
5
- Project.any_instance.stub(:subscribe_owner_to_success_list)
6
- Project.any_instance.stub(:subscribe_owner_to_failed_list)
5
+ allow_any_instance_of(Project).to receive(:subscribe_owner_to_success_list)
6
+ allow_any_instance_of(Project).to receive(:subscribe_owner_to_failed_list)
7
7
  end
8
8
 
9
9
  context "when project is successful" do
10
- let(:project) { create(:project, state: 'waiting_funds', goal: 10, online_days: -10, online_date: 20.days.ago ) }
10
+ let(:project) { Project.new }
11
11
 
12
12
  before do
13
- project.stub(:pledged).and_return(30)
13
+ allow(project).to receive(:pledged){ 30 }
14
14
 
15
- project.should_receive(:subscribe_owner_to_success_list)
16
- project.should_not_receive(:subscribe_owner_to_failed_list)
15
+ expect(project).to receive(:subscribe_owner_to_success_list)
16
+ expect(project).to_not receive(:subscribe_owner_to_failed_list)
17
17
  end
18
18
 
19
- it { project.finish }
19
+ it("should receive subscribe_owner_to_success_list"){ project.notify_observers :from_online_to_successful }
20
20
  end
21
21
 
22
22
  context "when project is failed" do
23
- let(:project) { create(:project, state: 'waiting_funds', goal: 10, online_days: -10, online_date: 20.days.ago ) }
23
+ let(:project) { Project.new }
24
24
 
25
25
  before do
26
- project.should_not_receive(:subscribe_owner_to_success_list)
27
- project.should_receive(:subscribe_owner_to_failed_list)
26
+ expect(project).to_not receive(:subscribe_owner_to_success_list)
27
+ expect(project).to receive(:subscribe_owner_to_failed_list)
28
28
  end
29
29
 
30
- it { project.finish }
30
+ it("should receive subscribe_owner_to_failed_list"){ project.notify_observers :from_online_to_failed }
31
31
  end
32
32
  end
@@ -3,47 +3,47 @@ require 'spec_helper'
3
3
  describe User do
4
4
  describe "before_save" do
5
5
  before do
6
- User.any_instance.stub(:subscribe_to_newsletter_list)
7
- User.any_instance.stub(:unsubscribe_from_newsletter_list)
6
+ allow_any_instance_of(User).to receive(:subscribe_to_newsletter_list)
7
+ allow_any_instance_of(User).to receive(:unsubscribe_from_newsletter_list)
8
8
  end
9
9
 
10
10
  context "when user want to receive a newsletter" do
11
- let(:user) { build(:user, newsletter: true) }
11
+ let(:user) { User.new(newsletter: true) }
12
12
 
13
13
  before do
14
- user.should_receive(:subscribe_to_newsletter_list)
14
+ expect(user).to receive(:subscribe_to_newsletter_list)
15
15
  end
16
16
 
17
- it { user.save }
17
+ it { user.save! }
18
18
  end
19
19
 
20
20
  context "when user want to receive a newsletter but he changed they email" do
21
- let(:user) { create(:user, newsletter: true, email: 'foo@bar.com') }
21
+ let(:user) { User.create!(newsletter: true, email: 'foo@bar.com') }
22
22
 
23
23
  before do
24
- user.should_receive(:subscribe_to_newsletter_list)
25
- user.should_receive(:unsubscribe_from_newsletter_list).with('foo@bar.com')
24
+ expect(user).to receive(:subscribe_to_newsletter_list)
25
+ expect(user).to receive(:unsubscribe_from_newsletter_list).with('foo@bar.com')
26
26
  end
27
27
 
28
28
  it { user.update_attributes(email: 'new@email.com') }
29
29
  end
30
30
 
31
31
  context "when user is a new account and don't want to receive newsletter" do
32
- let(:user) { build(:user, newsletter: false) }
32
+ let(:user) { User.new(false) }
33
33
 
34
34
  before do
35
- user.should_not_receive(:subscribe_to_newsletter_list)
35
+ expect(user).to_not receive(:subscribe_to_newsletter_list)
36
36
  end
37
37
 
38
- it { user.save }
38
+ it { user.save! }
39
39
  end
40
40
 
41
41
  context "when user want to not receive newsletter anymore" do
42
- let(:user) { create(:user, newsletter: true, email: 'foo@bar.com') }
42
+ let(:user) { User.create!(newsletter: true, email: 'foo@bar.com') }
43
43
 
44
44
  before do
45
- user.should_not_receive(:subscribe_to_newsletter_list)
46
- user.should_receive(:unsubscribe_from_newsletter_list)
45
+ expect(user).to_not receive(:subscribe_to_newsletter_list)
46
+ expect(user).to receive(:unsubscribe_from_newsletter_list)
47
47
  end
48
48
 
49
49
  it { user.update_attributes(newsletter: false) }