diff options
| author | mo khan <mo@mokhan.ca> | 2014-11-22 21:35:54 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-11-22 21:35:54 -0700 |
| commit | 93d22d876deded6f7453dafef151db8d4582c8f5 (patch) | |
| tree | 140922d286f1fdffebcc241073f73b6d0aaf4e18 /spec | |
| parent | 84d4bc964b9f5e1eb93819087af564655a8cabef (diff) | |
| parent | 7620674929c024a7279dfa116deab8805f2fb2ec (diff) | |
Merge branch 'master' of bitbucket.org:cakeside/cakeside
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/controllers/api/v1/tutorials_controller_spec.rb | 5 | ||||
| -rw-r--r-- | spec/controllers/registrations_controller_spec.rb | 2 | ||||
| -rw-r--r-- | spec/controllers/sessions_controller_spec.rb | 4 | ||||
| -rw-r--r-- | spec/factories.rb | 8 | ||||
| -rw-r--r-- | spec/features/change_password_spec.rb | 4 | ||||
| -rw-r--r-- | spec/features/registration_spec.rb | 2 | ||||
| -rw-r--r-- | spec/mailers/notification_mailer_spec.rb | 8 | ||||
| -rw-r--r-- | spec/mailers/previews/notification_mailer_preview.rb | 2 | ||||
| -rw-r--r-- | spec/models/favorite_spec.rb | 2 |
9 files changed, 18 insertions, 19 deletions
diff --git a/spec/controllers/api/v1/tutorials_controller_spec.rb b/spec/controllers/api/v1/tutorials_controller_spec.rb index 435e6136..7d7ef5c6 100644 --- a/spec/controllers/api/v1/tutorials_controller_spec.rb +++ b/spec/controllers/api/v1/tutorials_controller_spec.rb @@ -11,9 +11,8 @@ describe Api::V1::TutorialsController do let(:my_tutorial) { create(:tutorial, user: user) } let(:other_tutorial) { create(:tutorial) } - it "returns the users tutorials" do - get :index, format: :json + xhr :get, :index expect(assigns(:tutorials)).to include(my_tutorial) expect(assigns(:tutorials)).to_not include(other_tutorial) end @@ -28,7 +27,7 @@ describe Api::V1::TutorialsController do description: "Connect with your friends - and other fascinating people. Get in-the-moment updates on the things that interest you. And watch events unfold, in real time, from every angle.", tags: "cake,cookie", } - post :create, tutorial: attributes, format: :json + xhr :post, :create, tutorial: attributes expect(assigns(:tutorial)).to be_present expect(assigns(:tutorial).url).to eql(attributes[:url]) diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 692500fd..9a9eaf63 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -10,7 +10,7 @@ describe RegistrationsController do post :create, user: { name: 'mo', email: 'mo@cakeside.com', password: 'password' } expect(User.count).to eql(1) - expect(response).to redirect_to(my_root_path) + expect(response).to redirect_to(my_dashboard_path) expect(cookies.signed[:raphael]).to_not be_nil expect(cookies.signed[:raphael]).to eql(user_session.access) end diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index 7de183d9..63ca58ca 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -17,7 +17,7 @@ describe SessionsController do it "redirects to the dashboard" do get :new - expect(response).to redirect_to(my_root_path) + expect(response).to redirect_to(my_dashboard_path) end end end @@ -39,7 +39,7 @@ describe SessionsController do end it "redirects to the dashboard" do - expect(response).to redirect_to(my_root_path) + expect(response).to redirect_to(my_dashboard_path) end end diff --git a/spec/factories.rb b/spec/factories.rb index 2f4acaee..e1f30710 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -1,7 +1,7 @@ FactoryGirl.define do factory :activity, class: Activity do - user { FactoryGirl.create(:user) } - subject { FactoryGirl.create(:creation) } + user { create(:user) } + subject { create(:favorite) } end factory :category, class: Category do @@ -31,8 +31,8 @@ FactoryGirl.define do end factory :favorite do - user { FactoryGirl.create(:user) } - creation { FactoryGirl.create(:creation) } + association :user + association :creation end factory :photo, class: Photo do diff --git a/spec/features/change_password_spec.rb b/spec/features/change_password_spec.rb index 94f4dbb9..39bcaf9f 100644 --- a/spec/features/change_password_spec.rb +++ b/spec/features/change_password_spec.rb @@ -11,8 +11,8 @@ describe "changing my password", js: true do fill_in('session_password', :with => "password") end click_button("Sign In") - visit my_root_path - click_link("Account Settings") + visit my_dashboard_path + click_link("Account") within(".form-horizontal") do fill_in('user_password', :with => "mopass") fill_in('user_password_confirmation', :with => "mopass") diff --git a/spec/features/registration_spec.rb b/spec/features/registration_spec.rb index 81144517..25bc2724 100644 --- a/spec/features/registration_spec.rb +++ b/spec/features/registration_spec.rb @@ -13,7 +13,7 @@ describe "Registration", :js => true do end it "should let you register with that email address" do - expect(page).to have_content("No new activity to report.") + expect(page).to have_content("Dashboard") end xit "should take you to the settings page" do diff --git a/spec/mailers/notification_mailer_spec.rb b/spec/mailers/notification_mailer_spec.rb index fc5c8366..c67ab53e 100644 --- a/spec/mailers/notification_mailer_spec.rb +++ b/spec/mailers/notification_mailer_spec.rb @@ -2,15 +2,15 @@ require "rails_helper" describe NotificationMailer do context "send welcome email" do - let(:activity) { build(:activity) } - let(:mail) { NotificationMailer.notification_email(activity) } + let(:user) { build(:user) } + let(:mail) { NotificationMailer.notification_email(user) } it "adds a subject" do mail.subject.should == "New Activity on CakeSide" end it "sends to the users email" do - mail.to.should include activity.user.email + mail.to.should include user.email end it "should send from the correct address" do @@ -18,7 +18,7 @@ describe NotificationMailer do end it "includes their name" do - mail.body.encoded.should match(activity.user.name) + mail.body.encoded.should match(user.name) end end end diff --git a/spec/mailers/previews/notification_mailer_preview.rb b/spec/mailers/previews/notification_mailer_preview.rb index ca5d236a..c4d0e9be 100644 --- a/spec/mailers/previews/notification_mailer_preview.rb +++ b/spec/mailers/previews/notification_mailer_preview.rb @@ -1,5 +1,5 @@ class NotificationMailerPreview < ActionMailer::Preview def notification_email - NotificationMailer.notification_email(Activity.last) + NotificationMailer.notification_email(User.last) end end diff --git a/spec/models/favorite_spec.rb b/spec/models/favorite_spec.rb index 36e4031c..523e835e 100644 --- a/spec/models/favorite_spec.rb +++ b/spec/models/favorite_spec.rb @@ -7,7 +7,7 @@ describe Favorite do let(:user) { create(:user) } it "creates a new activity" do - creation.favorites.create(:user => user) + user.favorites.create(creation: creation) creation.author.activities.count.should == 1 end end |
