Hi Guys,
First post on group :). My problem is i couldn’t access the test
fixtures on
unit test class with using namespaces.
My fixtures at /test/fixtures/kebab/users.yml
onur:
user_name: onur.ozgur.ozkan
email: [email protected]
password: 123456
My unit test at test/unit/kebab/user_test.rb
require ‘test_helper’
class Kebab::UserTest < ActiveSupport::TestCase
- fixtures ‘kebab/users’*
test “user is not valid without a unique user_name” do
user = Kebab::User.new(
:user_name => users(:onur).user_name,
:email => ‘[email protected]’,
:password => ‘password’
)
assert !user.save
assert_equal “has already been taken”,
user.errors[:user_name].join(';
')
end
end
When i run test i get
NoMethodError: undefined method users' for #<Kebab::UserTest:0xb692c1e0> test/unit/kebab/user_test.rb:15:in test_user_is_not_valid_without_a_unique_user_name’
How can i access the fixtures data at user_test.rb?
Best regards.
Onur zgr ZKAN
**lab2023 - internet teknolojileri