Check select box has certain options with Capybara

Try using the capybara rspec matcher have_select(locator, options = {}) instead: #Find a select box by (label) name or id and assert the given text is selected Then /^”([^”]*)” should be selected for “([^”]*)”$/ do |selected_text, dropdown| expect(page).to have_select(dropdown, :selected => selected_text) end #Find a select box by (label) name or id and assert the … Read more

What are the differences between JBehave and Cucumber?

JBehave and Cucumber are completely different frameworks, although meant for the same purpose: acceptance tests. They are based around stories (JBehave) or features (Cucumber). A feature is a collection of stories, expressed from the point of view of a specific project stakeholder. In your tests, you are referring to the stories, typically via regular expression … Read more

Find or create record through factory_girl association

You can to use initialize_with with find_or_create method FactoryGirl.define do factory :group do name “name” initialize_with { Group.find_or_create_by_name(name)} end factory :user do association :group end end It can also be used with id FactoryGirl.define do factory :group do id 1 attr_1 “default” attr_2 “default” … attr_n “default” initialize_with { Group.find_or_create_by_id(id)} end factory :user do association … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)