diff --git a/lib/dotenv/parser.rb b/lib/dotenv/parser.rb index ae30c187..d6bdec56 100644 --- a/lib/dotenv/parser.rb +++ b/lib/dotenv/parser.rb @@ -59,8 +59,6 @@ def parse_line(line) if variable_not_set?(line) raise FormatError, "Line #{line.inspect} has an unset variable" end - elsif line !~ /\A\s*(?:#.*)?\z/ # not comment or blank line - raise FormatError, "Line #{line.inspect} doesn't match format" end end diff --git a/spec/dotenv/parser_spec.rb b/spec/dotenv/parser_spec.rb index e28a237c..005ef0f8 100644 --- a/spec/dotenv/parser_spec.rb +++ b/spec/dotenv/parser_spec.rb @@ -114,8 +114,8 @@ def env(string) expect(env("foo=bar ")).to eql("foo" => "bar") # not 'bar ' end - it "throws an error if line format is incorrect" do - expect { env("lol$wut") }.to raise_error(Dotenv::FormatError) + it "ignores lines that are not variable assignments" do + expect(env("lol$wut")).to eql({}) end it "ignores empty lines" do