Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FactoryGirl.define do
- factory :user do
- email "mail@mail.com"
- password "foobarrr"
- password_confirmation "foobarrr"
- end
- factory :poll do
- topic "What your name?"
- trait :vote_option1 do
- association :vote_option, title: "Dima"
- end
- trait :vote_option2 do
- association :vote_option, title: "Sasha"
- end
- end
- end
- require 'rails_helper'
- RSpec.describe Poll, type: :model do
- let(:user) { FactoryGirl.create(:user) }
- #subject { @poll }
- #it { should respond_to(:topic) }
- #it {should be_valid}
- describe "wrong information" do
- describe "less than or equal 1 vote option" do
- before do
- FactoryGirl.create(:poll, :vote_option1)
- end
- it { should_not be_valid }
- end
- end
- end
- ...........................
- group :test do
- gem 'capybara', '~> 2.4.4'
- gem 'selenium-webdriver', '~> 2.46.2'
- gem 'factory_girl_rails', '~> 4.5.0'
- end
- FactoryGirl.define do
- factory :user do
- email "mail@mail.com"
- password "foobarrr"
- password_confirmation "foobarrr"
- end
- factory :poll do
- topic "What your name?"
- trait :vote_option1 do
- association :vote_option, title: "Dima"
- end
- trait :vote_option2 do
- association :vote_option, title: "Sasha"
- end
- factory :poll_with_vote1, traits: [:vote_option1]
- factory :poll_with_vote2, traits: [:vote_option2]
- end
- end
- describe "wrong information" do
- describe "less than or equal 1 vote option" do
- before do
- FactoryGirl.create(:poll_with_vote1)
- end
- it { should_not be_valid }
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement