Commit 630010a
Changed files (4)
spec
controllers
factories
features
models
spec/controllers/registrations_controller_spec.rb
@@ -15,7 +15,12 @@ describe RegistrationsController do
context "when valid params are provided" do
before :each do
- post :create, user: { username: username, password: password, email: email, terms_and_conditions: '1' }
+ post :create, user: {
+ username: username,
+ password: password,
+ email: email,
+ terms_and_conditions: '1'
+ }
end
it 'creates a new user account' do
@@ -40,7 +45,12 @@ describe RegistrationsController do
context "when the parameters provided are invalid" do
before :each do
- post :create, user: { username: '', password: password, email: email, terms_and_conditions: '1' }
+ post :create, user: {
+ username: '',
+ password: password,
+ email: email,
+ terms_and_conditions: '1'
+ }
end
it 'adds an error to the flash for missing usernames' do
spec/factories/users.rb
@@ -2,6 +2,6 @@ FactoryGirl.define do
factory :user do
username Faker::Internet.user_name
email Faker::Internet.email
- terms_and_conditions '1'
+ terms_and_conditions "1"
end
end
spec/features/registrations_spec.rb
@@ -35,7 +35,7 @@ feature "Registrations", type: :feature do
end
context "when the terms and conditions are not accepted" do
- it 'displays an error' do
+ it "displays an error" do
subject.register_with(accept_terms: false)
expect(page).to have_content("Terms and conditions must be accepted")
spec/models/user_spec.rb
@@ -64,7 +64,11 @@ describe User do
end
it 'is valid when it is' do
- user = User.new(username: 'coolio', email: 'notblank@example.com', password: 'legit', terms_and_conditions: '1')
+ user = User.new(
+ username: 'coolio',
+ email: 'notblank@example.com',
+ password: 'legit',
+ terms_and_conditions: '1')
expect(user).to be_valid
end
end